Improve code quality
This commit is contained in:
parent
39ddf8fde9
commit
8193b85274
26 changed files with 187 additions and 138 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue