Fixed API issues and added a test file

This commit is contained in:
2024-03-11 12:19:19 +01:00
parent 6d941b7bf1
commit 6452ec2dba
10 changed files with 71 additions and 31 deletions

View File

@@ -1,6 +1,7 @@
import jwt from 'jsonwebtoken';
import { Level } from 'level';
import { pool } from './databaseManager';
import { error } from '../modules/logManager';
import { respondWithStatus } from './requestHandler';
const db = new Level('tokens', { valueEncoding: 'json' });
@@ -31,7 +32,8 @@ export async function verifyToken(req, res, next) {
}
next();
}
catch (error) {
catch (err) {
error(err);
return await respondWithStatus(res, 401, 'Invalid user');
}
}