Now loading user in a wrapper for the app, added loading screen
This commit is contained in:
parent
864b7b0689
commit
eafb88ebfc
8 changed files with 734 additions and 66 deletions
|
|
@ -19,21 +19,13 @@ export default function AuthWrapper(props: Props) {
|
|||
if (isAuthenticated) getAccessTokenSilently().then(t => {
|
||||
if (t.length < 1) {
|
||||
loginWithRedirect()
|
||||
} else {
|
||||
|
||||
}
|
||||
setToken(t)
|
||||
}).catch(() => {
|
||||
// No token, go back to login
|
||||
loginWithRedirect()
|
||||
})
|
||||
}, [setToken, isAuthenticated])
|
||||
}, [setToken, isAuthenticated])
|
||||
|
||||
if (isAuthenticated) return (
|
||||
children
|
||||
)
|
||||
|
||||
return (
|
||||
<p>Redirecting...</p>
|
||||
)
|
||||
return children;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue