sdy

update frontend gql

1 -export const defaults = {}; 1 +export const defaults = {
2 + isLoggedIn: Boolean(localStorage.getItem("token") || false),
3 +};
2 4
3 -export const resolvers = {}; 5 +export const resolvers = {
6 + Mutation: {
7 + logUserIn: (_, { token }, { cache }) => {
8 + localStorage.setItem("token", token);
9 + cache.writeData({
10 + data: {
11 + isLoggedIn: true,
12 + },
13 + });
14 + return null;
15 + },
16 + logUserOut: (_, __, { cache }) => {
17 + localStorage.removeItem("token");
18 + window.location.reload();
19 + return null;
20 + },
21 + },
22 +};
......