persistent login now works, no more cookie errors

This commit is contained in:
Carter 2024-10-23 12:41:52 -06:00
parent a7b417abdf
commit 47e3939112
5 changed files with 16 additions and 25 deletions

View file

@ -6,25 +6,19 @@ export default function AuthWrapper(props: PropsWithChildren<{}>) {
const { children } = props;
const { isLoading, loginWithRedirect, isAuthenticated, user } = useAuth0();
useEffect(() => {
// console.log("Authenticated: ", isAuthenticated)
// console.log("Loading: ", isLoading)
if (!isAuthenticated && !isLoading) {
loginWithRedirect();
}
}, [isAuthenticated, loginWithRedirect]);
}, [isAuthenticated, loginWithRedirect, isLoading]);
useEffect(() => {
console.log(user)
console.log(user?.sub)
console.log(user?.picture)
if (isAuthenticated) return (
children
)
}, [user])
// if (isAuthenticated) return (
// children
// )
return (children)
return (
<p>Redirecting...</p>
)
}