bugfix: organization not selected problem fixed. being logged out too often fixed.
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
routing,
|
||||
stripLocaleFromPathname,
|
||||
} from './i18n/routing';
|
||||
import { hasUsableAccessToken } from './lib/auth/accessToken';
|
||||
|
||||
const handleI18nRouting = createMiddleware(routing);
|
||||
|
||||
@@ -36,7 +37,7 @@ export function proxy(request: NextRequest) {
|
||||
const pathWithoutLocale = stripLocaleFromPathname(pathname);
|
||||
const locale = getLocaleFromPathname(pathname);
|
||||
const token = request.cookies.get('accessToken')?.value;
|
||||
const isAuthenticated = !!token;
|
||||
const isAuthenticated = hasUsableAccessToken(token);
|
||||
|
||||
if (isAuthenticated && pathWithoutLocale === '/') {
|
||||
return NextResponse.redirect(new URL(`/${locale}/today`, request.url));
|
||||
|
||||
Reference in New Issue
Block a user