Improve code quality

This commit is contained in:
aronmal 2023-04-10 20:21:27 +02:00
parent 39ddf8fde9
commit 8193b85274
Signed by: aronmal
GPG key ID: 816B7707426FC612
26 changed files with 187 additions and 138 deletions

View file

@ -2,7 +2,7 @@ import jwt from "jsonwebtoken"
import errors from "../errors"
import jwtVerifyCatch from "../jwtVerifyCatch"
import sendError, { API } from "./sendError"
import { IdToken, RawToken } from "./createTokenDB"
import type { IdToken, RawToken } from "./createTokenDB"
async function checkTokenIsValid(
context: API,
@ -14,7 +14,7 @@ async function checkTokenIsValid(
// Verify the token and get the payload
let data: string | jwt.JwtPayload
try {
data = jwt.verify(value, process.env.ACCESS_TOKEN_SECRET as string)
data = jwt.verify(value, process.env.TOKEN_SECRET as string)
} catch (err: any) {
// Deal with the problem in more detail
return sendError(context, jwtVerifyCatch(type, err))