From 1c95f11c87f8205012eab33fa6f5f39968a6bcbb Mon Sep 17 00:00:00 2001 From: Florian Bouillon Date: Fri, 3 Jul 2020 11:41:59 +0200 Subject: [PATCH] Faite :D --- Controller/ApiController.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Controller/ApiController.js b/Controller/ApiController.js index 4d4c864..2885516 100644 --- a/Controller/ApiController.js +++ b/Controller/ApiController.js @@ -9,10 +9,11 @@ module.exports = class ApiController { } single(req, res) { - if (req.query.id === '') { + const entity = this.db.getByID(req.query.id) + if (req.query.id === '' || !entity) { res.send({ message: 'Identifiant incorrect' }) } else { - res.send(this.db.getByID(req.query.id)) + res.send(entity) } } } \ No newline at end of file