【发布时间】:2022-05-05 00:36:08
【问题描述】:
您好,我是 ApolloClient 的新手,我不知道将多个 URI 链接作为 clint 传递,如果有人知道的话,我必须使用所有 URI 给我建议,接下来我必须做什么。
import { ApolloClient, InMemoryCache, HttpLink, ApolloLink } from '@apollo/client';
// Set `RestLink` with your endpoint
const shopLink = new HttpLink({ uri: 'https://demo.vendure.io/shop-api' });
const cmsLink = new HttpLink({
uri: 'https://cms.trylah.sg/graphql',
});
const vendureLink = new HttpLink({
// Production
//uri: 'https://demo.trylah.sg/shop-api',
uri: process.env.REACT_APP_SHOP_API_URL || 'http://localhost:3000/shop-api',
credentials: 'include',
});
export const client = new ApolloClient({
link: shopLink,
cache: new InMemoryCache(),
});
【问题讨论】:
标签: graphql apollo-client react-apollo