From 62121cbc5385d727df8ba11833d037c21e782dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9luchu?= Date: Wed, 3 Jun 2020 13:14:35 +0200 Subject: [PATCH] Test force json parse MoreInfo - Fase 2 --- src/api/routes/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/api/routes/index.js b/src/api/routes/index.js index 07ff53f..e80afdf 100644 --- a/src/api/routes/index.js +++ b/src/api/routes/index.js @@ -171,12 +171,11 @@ router.get('/moreInfo/:title' , (req, res) =>{ let title = req.params.title; api.getMoreInfo(title) - .then(data =>{ - if (data.length > 0) { - let info = JSON.parse(JSON.stringify(data)) - res.status(200).json({ - info - }); + .then(info =>{ + if (info.length > 0) { + res.status(200).json( + JSON.parse(JSON.stringify(info[0])) + ); } else { res.status(400) } }).catch((err) =>{ console.error(err);