In progress changes for Kanban Board and updated schema migrations. Performed some cleanup.
This commit is contained in:
@@ -15,6 +15,7 @@ import Unauthorized from "../pages/unauthorized/unauthorized.component";
|
||||
import { auth } from "../firebase/firebase.utils";
|
||||
import { UPSERT_USER } from "../graphql/user.queries";
|
||||
import { GET_CURRENT_USER } from "../graphql/local.queries";
|
||||
import { QUERY_BODYSHOP } from "../graphql/bodyshop.queries";
|
||||
import LoadingSpinner from "../components/loading-spinner/loading-spinner.component";
|
||||
import AlertComponent from "../components/alert/alert.component";
|
||||
|
||||
@@ -42,18 +43,6 @@ export default () => {
|
||||
});
|
||||
}
|
||||
|
||||
apolloClient.writeData({
|
||||
data: {
|
||||
currentUser: {
|
||||
email: user.email,
|
||||
displayName: user.displayName,
|
||||
token,
|
||||
uid: user.uid,
|
||||
photoUrl: user.photoURL,
|
||||
__typename: "currentUser"
|
||||
}
|
||||
}
|
||||
});
|
||||
//add the bearer token to the headers.
|
||||
localStorage.setItem("token", token);
|
||||
|
||||
@@ -66,6 +55,36 @@ export default () => {
|
||||
.catch(error => {
|
||||
console.log("Upsert error!!!!", error);
|
||||
});
|
||||
|
||||
apolloClient
|
||||
.query({
|
||||
query: QUERY_BODYSHOP,
|
||||
fetchPolicy: "network-only"
|
||||
})
|
||||
.then(r => {
|
||||
const bodyShopData = r.data.bodyshops[0];
|
||||
apolloClient.writeData({
|
||||
data: {
|
||||
bodyShopData: { ...bodyShopData, __typename: "bodyShopData" }
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.log("Error getting bodyshop data.", error);
|
||||
});
|
||||
|
||||
apolloClient.writeData({
|
||||
data: {
|
||||
currentUser: {
|
||||
email: user.email,
|
||||
displayName: user.displayName,
|
||||
token,
|
||||
uid: user.uid,
|
||||
photoUrl: user.photoURL,
|
||||
__typename: "currentUser"
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
apolloClient.writeData({ data: { currentUser: null } });
|
||||
localStorage.removeItem("token");
|
||||
|
||||
Reference in New Issue
Block a user