import { InMemoryCache, makeVar } from '@apollo/client';
const isLoggedIn = () => Cookies.get('TOKEN');
export const isUserLoggedInVar = makeVar(isLoggedIn());
const cache = new InMemoryCache({
typePolicies: {
Query: {
fields: {
readNumOfOutofStockItems: {
read(cart, { readField }) {
// logic of OutofStock items
}
},
isUserLoggedIn: {
read() {
return isUserLoggedInVar();
}
}
}
}
}
const client = new ApolloClient({ cache });
Gets the 'token' cookie
How we create
reactive var
How we declare
reactive var
here