This commit is contained in:
Lukian LEIZOUR 2024-06-01 19:14:23 +02:00
parent 0bac40a72f
commit 8ace4a6356
6 changed files with 32 additions and 7 deletions

View file

@ -8,12 +8,14 @@ const router = express.Router();
router.post('/', async (req, res) => {
const {token} = req.body;
let user;
if (!token) {
return res.status(400).send({error: "invalid token"});
}
try {
user = jwt.verify(token, process.env.JWTSecret);
jwt.verify(token, process.env.JWTSecret);
} catch {
return res.status(500).send({error: "invalid token"});
return res.status(400).send({error: "invalid token"});
}
const games = await getGames();