nice loading states and stuff
This commit is contained in:
@@ -64,6 +64,8 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
const tokenListener = window.electronAPI.once(
|
const tokenListener = window.electronAPI.once(
|
||||||
Channels.GOOGLE_AUTH_TOKENS,
|
Channels.GOOGLE_AUTH_TOKENS,
|
||||||
async (tokens: Credentials) => {
|
async (tokens: Credentials) => {
|
||||||
|
setAuthIniting(true);
|
||||||
|
|
||||||
console.log('got tokens', tokens);
|
console.log('got tokens', tokens);
|
||||||
|
|
||||||
const credential = GoogleAuthProvider.credential(tokens.id_token);
|
const credential = GoogleAuthProvider.credential(tokens.id_token);
|
||||||
@@ -84,6 +86,8 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
|
setAuthIniting(false);
|
||||||
|
|
||||||
// Handle Errors here.
|
// Handle Errors here.
|
||||||
const errorCode = error.code;
|
const errorCode = error.code;
|
||||||
const errorMessage = error.message;
|
const errorMessage = error.message;
|
||||||
@@ -99,7 +103,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return () => tokenListener();
|
return () => tokenListener();
|
||||||
}, [enqueueSnackbar]);
|
}, [enqueueSnackbar, setAuthIniting]);
|
||||||
|
|
||||||
const logout = useCallback(() => firebaseAuth.signOut(), []);
|
const logout = useCallback(() => firebaseAuth.signOut(), []);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user