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()]);