persistent login now works, no more cookie errors
This commit is contained in:
parent
a7b417abdf
commit
47e3939112
5 changed files with 16 additions and 25 deletions
|
|
@ -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>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue