🐛 Fix check for missing token on initial render (#1054)

This commit is contained in:
Luke Vella 2024-03-14 14:08:15 +07:00 committed by GitHub
parent 7ebaabe232
commit 8a69deee53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -48,10 +48,10 @@ export const middleware = withAuth(
callbacks: { callbacks: {
authorized: ({ token, req }) => { authorized: ({ token, req }) => {
const nextUrl = req.nextUrl; const nextUrl = req.nextUrl;
const isGuest = !token?.email;
if ( if (
isSelfHosted && isSelfHosted &&
token?.email === null && isGuest &&
!( !(
nextUrl.pathname.startsWith("/invite") || nextUrl.pathname.startsWith("/invite") ||
nextUrl.pathname.startsWith("/login") || nextUrl.pathname.startsWith("/login") ||