diff --git a/apps/client/src/features/app-settings/panel/sources-panel/GSheetSetup.tsx b/apps/client/src/features/app-settings/panel/sources-panel/GSheetSetup.tsx index af9d6bddc0..c32dcce666 100644 --- a/apps/client/src/features/app-settings/panel/sources-panel/GSheetSetup.tsx +++ b/apps/client/src/features/app-settings/panel/sources-panel/GSheetSetup.tsx @@ -33,6 +33,7 @@ export default function GSheetSetup(props: GSheetSetupProps) { const patchStepData = useSheetStore((state) => state.patchStepData); const authenticationStatus = useSheetStore((state) => state.authenticationStatus); const setAuthenticationStatus = useSheetStore((state) => state.setAuthenticationStatus); + const authenticationError = useSheetStore((state) => state.stepData.authenticate.error); /** Check if we are authenticated */ const getAuthStatus = async () => { @@ -44,6 +45,7 @@ export default function GSheetSetup(props: GSheetSetupProps) { /** check if the current session has been authenticated */ useEffect(() => { + patchStepData({ authenticate: { available: false, error: '' } }); untilAuthenticated(); }, []); @@ -150,7 +152,7 @@ export default function GSheetSetup(props: GSheetSetupProps) { Upload Client Secret provided by Google - {undefined} + {authenticationError} => { try { - return verifyAuthenticationStatus(); - } catch (_error) { - /** we do not handle errors here */ + return await verifyAuthenticationStatus(); + } catch (error) { + patchStepData({ authenticate: { available: false, error: maybeAxiosError(error) } }); } }; @@ -37,18 +37,18 @@ export default function useGoogleSheet() { sheetId: string, ): Promise<{ verification_url: string; user_code: string } | void> => { try { - return requestConnection(file, sheetId); - } catch (_error) { - /** we do not handle errors here */ + return await requestConnection(file, sheetId); + } catch (error) { + patchStepData({ authenticate: { available: false, error: maybeAxiosError(error) } }); } }; /** requests the revoking of an existing authenticated session */ const revoke = async (): Promise<{ authenticated: AuthenticationStatus } | void> => { try { - return revokeAuthentication(); - } catch (_error) { - /** we do not handle errors here */ + return await revokeAuthentication(); + } catch (error) { + patchStepData({ authenticate: { available: false, error: maybeAxiosError(error) } }); } };