diff --git a/src/features/app_start/vip/startup/useStartup.tsx b/src/features/app_start/vip/startup/useStartup.tsx index bb9c8c5264..f6c0153671 100644 --- a/src/features/app_start/vip/startup/useStartup.tsx +++ b/src/features/app_start/vip/startup/useStartup.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; -import { useRecoilValue, useSetRecoilState } from 'recoil'; +import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'; import { congIDState, congregationCreateStepState, @@ -19,7 +19,6 @@ import { setIsEmailLinkAuthenticate, setIsEncryptionCodeOpen, setIsSetup, - setIsUserSignIn, setUserMfaVerify, } from '@services/recoil/app'; import { @@ -37,6 +36,8 @@ import { userSignOut } from '@services/firebase/auth'; const useStartup = () => { const [searchParams] = useSearchParams(); + const [isUserSignIn, setIsUserSignIn] = useRecoilState(isUserSignInState); + const setCookiesConsent = useSetRecoilState(cookiesConsentState); const setCongCreate = useSetRecoilState(isCongAccountCreateState); const setCurrentStep = useSetRecoilState(congregationCreateStepState); @@ -44,7 +45,6 @@ const useStartup = () => { const isEmailLinkAuth = useRecoilValue(isEmailLinkAuthenticateState); const isEmailAuth = useRecoilValue(isEmailAuthState); - const isUserSignIn = useRecoilValue(isUserSignInState); const isUserMfaVerify = useRecoilValue(isUserMfaVerifyState); const isUserAccountCreated = useRecoilValue(isUserAccountCreatedState); const isOfflineOverride = useRecoilValue(offlineOverrideState); @@ -63,7 +63,7 @@ const useStartup = () => { const showSignin = useCallback(() => { setIsUserSignIn(true); setUserMfaVerify(false); - }, []); + }, [setIsUserSignIn]); const runStartupCheck = useCallback(async () => { setIsLoading(true); @@ -198,7 +198,7 @@ const useStartup = () => { } if (cookiesConsent && isStart) runStartupCheck(); - }, [cookiesConsent, isStart, runStartupCheck]); + }, [setIsUserSignIn, cookiesConsent, isStart, runStartupCheck]); return { isEmailAuth, diff --git a/src/features/persons/button_actions/useButtonActions.tsx b/src/features/persons/button_actions/useButtonActions.tsx index 055745f785..cba1289d6a 100644 --- a/src/features/persons/button_actions/useButtonActions.tsx +++ b/src/features/persons/button_actions/useButtonActions.tsx @@ -45,6 +45,7 @@ const useButtonActions = () => { icon: , }); + navigate(-1); navigate('/persons'); } diff --git a/src/hooks/useUserAutoLogin.tsx b/src/hooks/useUserAutoLogin.tsx index fc1f76103a..8463147c14 100644 --- a/src/hooks/useUserAutoLogin.tsx +++ b/src/hooks/useUserAutoLogin.tsx @@ -8,6 +8,8 @@ import { isAppLoadState, isMFAEnabledState, isOnlineState, + isSetupState, + offlineOverrideState, userIDState, } from '@states/app'; import { apiValidateMe } from '@services/api/user'; @@ -40,6 +42,9 @@ const useUserAutoLogin = () => { const setCongConnected = useSetRecoilState(congAccountConnectedState); const setUserID = useSetRecoilState(userIDState); const setIsMFAEnabled = useSetRecoilState(isMFAEnabledState); + const setOfflineOverride = useSetRecoilState(offlineOverrideState); + const setIsSetup = useSetRecoilState(isSetupState); + const setIsAppLoad = useSetRecoilState(isAppLoadState); const isOnline = useRecoilValue(isOnlineState); const apiHost = useRecoilValue(apiHostState); @@ -165,6 +170,12 @@ const useUserAutoLogin = () => { await userSignOut(); setCongConnected(false); + setOfflineOverride(true); + + setTimeout(() => { + setIsAppLoad(true); + setIsSetup(true); + }, 2000); return; } @@ -224,6 +235,9 @@ const useUserAutoLogin = () => { setCongID, setUserID, setIsMFAEnabled, + setIsAppLoad, + setIsSetup, + setOfflineOverride, ]); useEffect(() => {