Fixed API issues and added a test file
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user