diff --git a/shared/models/auth/validateAndDecodeJWT.ts b/shared/models/auth/validateAndDecodeJWT.ts index a62fce6..ba60b0d 100644 --- a/shared/models/auth/validateAndDecodeJWT.ts +++ b/shared/models/auth/validateAndDecodeJWT.ts @@ -29,8 +29,13 @@ export interface UserSession { exp: number; } -export const validateAndDecodeJWT = async (): Promise => { +export const validateAndDecodeJWT = async (): Promise => { const cookieHeader = (await cookies()).get("auth_token")?.value; + + if (!cookieHeader) { + return null; + } + const res = (await backendFetch("auth/token/validate", { method: "POST", body: JSON.stringify({