File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/web/src/common/hooks Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1+ import { useEffect } from "react" ;
12import { useNavigate } from "react-router-dom" ;
23import { useHasCompletedSignup } from "@web/auth/useHasCompletedSignup" ;
34import { useSkipOnboarding } from "@web/auth/useSkipOnboarding" ;
@@ -10,9 +11,9 @@ import { OnboardingStepProps } from "@web/views/Onboarding";
1011
1112export function useGoogleAuth ( props ?: Partial < OnboardingStepProps > ) {
1213 const navigate = useNavigate ( ) ;
13- const { setAuthenticated } = useSession ( ) ;
14+ const { setAuthenticated, authenticated } = useSession ( ) ;
1415 const { markSignupCompleted } = useHasCompletedSignup ( ) ;
15- const { updateOnboardingStatus } = useSkipOnboarding ( ) ;
16+ const { updateOnboardingStatus, skipOnboarding } = useSkipOnboarding ( ) ;
1617
1718 const googleLogin = useGoogleLogin ( {
1819 onSuccess : async ( data ) => {
@@ -37,5 +38,11 @@ export function useGoogleAuth(props?: Partial<OnboardingStepProps>) {
3738 } ,
3839 } ) ;
3940
41+ useEffect ( ( ) => {
42+ if ( authenticated && skipOnboarding ) {
43+ navigate ( ROOT_ROUTES . ROOT ) ;
44+ }
45+ } , [ authenticated , navigate , skipOnboarding ] ) ;
46+
4047 return googleLogin ;
4148}
You can’t perform that action at this time.
0 commit comments