From 448f455186ee695ce0c70574db4fe2b431ad6c55 Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Thu, 21 Jan 2021 12:48:36 +0100 Subject: FIXERINIO --- profile/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'profile/index.js') diff --git a/profile/index.js b/profile/index.js index fcdf877..ded1ec4 100644 --- a/profile/index.js +++ b/profile/index.js @@ -17,7 +17,7 @@ app.get("/api/user/:uid", async (req, res) => { for (const answer of answers) { const qid = questions.findIndex((question) => question.id === answer.question_id); - if (qid !== undefined) questions[qid].answer = answer.answer; + if (qid >= 0) questions[qid].answer = answer.answer; } res.json({ user: user[0], questions }); }); @@ -33,7 +33,7 @@ app.get("/api/questions", async (req, res) => { for (const answer of answers) { const qid = questions.findIndex((question) => question.id === answer.question_id); - if (qid !== undefined) questions[qid].answer = answer.answer; + if (qid >= 0) questions[qid].answer = answer.answer; } res.json(questions); }); -- cgit v1.2.3