Additional fixes for firebase login. Capture basic local state.

This commit is contained in:
Patrick Fic
2019-12-06 17:55:00 -08:00
parent 0de42d3fee
commit 9f5753d1b7
15 changed files with 76 additions and 13 deletions

View File

@@ -9,7 +9,7 @@ import { HttpLink } from "apollo-link-http";
import ApolloClient from "apollo-client";
import { InMemoryCache } from "apollo-cache-inmemory";
import Spin from '../components/loading-spinner/loading-spinner.component'
import Spin from "../components/loading-spinner/loading-spinner.component";
const UPSERT_USER = gql`
mutation upsert_user($authEmail: String!, $authToken: String!) {
@@ -24,6 +24,12 @@ const UPSERT_USER = gql`
}
`;
const SET_CURRENT_USER = gql`
mutation SetCurrentUser($user: User!) {
setCurrentUser(user: $user) @client
}
`;
const client = new ApolloClient({
link: new HttpLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT
@@ -44,8 +50,8 @@ export default function Auth() {
mutation: UPSERT_USER,
variables: { authEmail: user.email, authToken: user.uid }
})
.then(r => console.log(r))
.catch(error => console.log("ERROR!!!!", error));
.then(r => console.log("Successful Upsert", r))
.catch(error => console.log("Upsert error!!!!", error));
const token = await user.getIdToken();
const idTokenResult = await user.getIdTokenResult();