From f90756c81bbd9d21a69acd3ad30d700eb03e114d Mon Sep 17 00:00:00 2001 From: talksik Date: Sat, 28 May 2022 12:22:22 -0500 Subject: [PATCH] nice loading states and stuff --- packages/desktop/src/providers/AuthProvider.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/desktop/src/providers/AuthProvider.tsx b/packages/desktop/src/providers/AuthProvider.tsx index d4d3088..fe4ac79 100644 --- a/packages/desktop/src/providers/AuthProvider.tsx +++ b/packages/desktop/src/providers/AuthProvider.tsx @@ -64,6 +64,8 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => { const tokenListener = window.electronAPI.once( Channels.GOOGLE_AUTH_TOKENS, async (tokens: Credentials) => { + setAuthIniting(true); + console.log('got tokens', tokens); const credential = GoogleAuthProvider.credential(tokens.id_token); @@ -84,6 +86,8 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => { }); }) .catch((error: any) => { + setAuthIniting(false); + // Handle Errors here. const errorCode = error.code; const errorMessage = error.message; @@ -99,7 +103,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => { ); return () => tokenListener(); - }, [enqueueSnackbar]); + }, [enqueueSnackbar, setAuthIniting]); const logout = useCallback(() => firebaseAuth.signOut(), []);