Added routing and basic board component.

This commit is contained in:
Patrick Fic
2019-12-09 21:33:58 -08:00
parent 7de41f77ae
commit 620d2419a3
20 changed files with 407 additions and 44 deletions

View File

@@ -5,5 +5,6 @@ export default {
token: null
},
selectedNavItem: "Home",
recentItems: []
recentItems: [],
whiteBoardLeftSiderVisible: true
};

View File

@@ -15,3 +15,9 @@ export const GET_CURRENT_USER = gql`
}
}
`;
export const GET_WHITE_BOARD_LEFT_SIDER_VISIBLE = gql`
{
whiteBoardLeftSiderVisible @client
}
`;

View File

@@ -1,9 +1,10 @@
import { gql } from "apollo-boost";
import { GET_CURRENT_USER } from "./local.queries";
import { GET_CURRENT_USER, GET_WHITE_BOARD_LEFT_SIDER_VISIBLE } from "./local.queries";
export const typeDefs = gql`
extend type Mutation {
SetCurrentUser(user: User!): User!
ToggleWhiteBoardLeftSiderVisible: Boolean!
}
extend type User {
@@ -22,6 +23,20 @@ export const resolvers = {
});
return user;
}
},
toggleWhiteBoardLeftSiderVisible: (_root, _args, { cache }) => {
const { whiteBoardLeftSiderVisible } = cache.readQuery({
query: GET_WHITE_BOARD_LEFT_SIDER_VISIBLE
});
cache.writeQuery({
query: GET_WHITE_BOARD_LEFT_SIDER_VISIBLE,
data: { whiteBoardLeftSiderVisible: !whiteBoardLeftSiderVisible }
});
return !whiteBoardLeftSiderVisible;
},
}
};