Add check for token without expiration date

This commit is contained in:
Aelita4 2023-11-11 23:19:12 +01:00
parent 4feba517aa
commit 9c99b27547
Signed by: Aelita4
GPG Key ID: E44490C2025906C1
1 changed files with 1 additions and 3 deletions

View File

@ -1,6 +1,4 @@
import { randomBytes } from "crypto";
import type { APIRoute } from "astro";
import type AccessToken from "../../../types/AccessToken";
import { getAccessToken } from "../../../lib/accessTokens";
export const GET: APIRoute = async({ request }) => {
@ -23,7 +21,7 @@ export const GET: APIRoute = async({ request }) => {
})
);
if(response.expiresAt.getTime() < Date.now()) return new Response(
if(response.expiresAt !== null && response.expiresAt.getTime() < Date.now()) return new Response(
JSON.stringify({
code: 403,
message: "Forbidden",