A
Size: a a a
A
MZ
AP
AP
MZ
AP
MZ
КС
$: ({field, field2, etc} = object);
КС
КС
КС
AP
К
К
К
EM
К
К
К
setClient(
new ApolloClient({
uri: myHost,
request: operation => {
operation.setContext({
headers: {
authorization: accessToken ? `Bearer ${accessToken}` : '',
reauthorization: refreshToken ? `Bearer ${refreshToken}` : '',
},
});
},
})
);
EM
export const getClient = (session = null) => {
const { token } = session
const authToken = process.browser ? cookies.get('token') : token
return new ApolloClient({
link: link(authToken),
cache: new InMemoryCache(),
})
}
const middlewareLink = new ApolloLink((operation, forward) => {
operation.setContext({
headers: {
Authorization: authToken ? `JWT ${authToken}` : null,
},
})