Fix
This commit is contained in:
@@ -57,4 +57,11 @@ CREATE TABLE game_questions (
|
||||
PRIMARY KEY (id),
|
||||
INDEX gq_game_idx (game),
|
||||
INDEX gq_question_idx (question)
|
||||
) ENGINE=InnoDB;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
INSERT INTO themes (theme) VALUES ('Environnement');
|
||||
INSERT INTO themes (theme) VALUES ('Energie Renouvelable');
|
||||
INSERT INTO themes (theme) VALUES ("Recyclage et consommation d'energie");
|
||||
INSERT INTO themes (theme) VALUES ('Pollution et energie fossile');
|
||||
INSERT INTO themes (theme) VALUES ('Politique');
|
||||
|
||||
@@ -63,8 +63,15 @@ router.post('/login', requestLimiter, async (req, res) => {
|
||||
});
|
||||
|
||||
router.post('verifyToken', requestLimiter, async (req, res) => {
|
||||
const token = req.headers.authorization;
|
||||
if (!token) return await respondWithStatus(res, 401, 'No token provided');
|
||||
try {
|
||||
const token = req.headers.authorization;
|
||||
if (!token) return await respondWithStatus(res, 401, 'No token provided');
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
return await respondWithStatus(res, 500, 'An error has occured');
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
const decoded = jwt.verify(token, process.env.JWT_SECRET);
|
||||
|
||||
Reference in New Issue
Block a user