Additional fixes for firebase login. Capture basic local state.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user