bugfix: organization not selected problem fixed. being logged out too often fixed.

This commit is contained in:
2026-07-12 17:51:31 +03:30
parent 39935688ad
commit 901d838a2c
14 changed files with 490 additions and 22 deletions

View File

@@ -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));