Open f1devrouaa opened 1 year ago
return new ApolloClient({
ssrMode: typeof window === 'undefined',
link: ApolloLink.from([
new MultiAPILink({
getContext: (endpoint) => {
if (endpoint === 'laravel') {
return {
headers: {
authorization: `Bearer ${Cookies.get(AUTH_TOKEN_KEY)}`,
},
errorLink: errorLink,
authLink : authLink,
cache : new InMemoryCache(),
}
} else if (endpoint === 'wordpress') {
return {
headers: {
},
errorLink: errorLinkwp,
authLink: authLinkwp,
afterware,
cache : new InMemoryCache(),
}
}
return {}
},
endpoints: {
laravel: httpLink,
wordpress: httpLinkwp,
...
}, //expression expected
createHttpLink: () => createHttpLink(),
}),
This is the alternative method we tried to get rid of error but we get now an error expression expected
So I ran into same issue as you and mananegd to fix it with a bit of struggle, basically instead of setting context or instead of using createHttpLink I did something like (url, endpoint) => if (endpoint == "main") { return ApolloLink.from([authLink, httpLink])}
We are trying to pass an apollo link object instead of string to the two endpoints but we are getting error that the apollo link is not assignable to type string.
How can this be fixed and how can we add different cache for each