相关疑难解决方法(0)

在 React Native apollo 客户端中调用突变时如何传递附加标头?

在 React Native apollo 客户端中调用突变时如何传递附加标头?

我的客户在这里:

import { HttpLink } from 'apollo-link-http';
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';

const makeApolloClient = (token) => {
  // create an apollo link instance, a network interface for apollo client
  const link = new HttpLink({
    uri: 'http://x.x.x.x:xxxx/xxxx',
    headers: {
     Authorization: `Bearer ${token}`
    },
  });
  // create an inmemory cache instance for caching graphql data
  const cache = new InMemoryCache();
  // instantiate apollo client with apollo link instance and …
Run Code Online (Sandbox Code Playgroud)

react-native react-apollo

5
推荐指数
2
解决办法
5423
查看次数

标签 统计

react-apollo ×1

react-native ×1