Skip to content

[Expo example] useEffect for auth redirection #6

@Alvi24

Description

@Alvi24

Why is useEffect with isAuthenticated used to redirect user after signIn and not await the signIn function and then redirect the user?

const {error} = await authClient.signIn.social({
	provider: "google",
	callbackURL: "/dashboard",
  });

if(error===null) router.push("/dashboard");

instead of this

useEffect(() => {
		if (isAuthenticated) {
			if (navContainerRef.isReady()) {
				router.push("/dashboard");
			}
		}
	}, [isAuthenticated, navContainerRef.isReady()]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions