Started introducing prisma to connect to MongoDB

This commit is contained in:
aronmal 2023-02-03 22:42:20 +01:00
parent 8397320a6b
commit 530a58f703
Signed by: aronmal
GPG key ID: 816B7707426FC612
11 changed files with 1734 additions and 42 deletions

View file

@ -0,0 +1,19 @@
export default async function jwtVerifyCatch(
tokenType: 'refreshToken' | 'accessToken',
err: Error
) {
switch (err.message) {
case 'jwt expired':
return { message: `JWT (${tokenType}) expired!`, statusCode: 403, solved: true, type: 'warn' }
case 'invalid signature':
return { message: `Invalid JWT (${tokenType}) signature! Token: `, statusCode: 401, solved: true, type: 'error' }
case 'jwt must be provided':
return { message: `No JWT (${tokenType}) given.`, statusCode: 401, solved: true, type: 'warn' }
default:
console.log(err)
return { message: `Unknown error on 'JWT.verify()'.`, solved: false }
}
}