From 09b2e1a0d014e2ddc3c6d4c440f42347cba46488 Mon Sep 17 00:00:00 2001 From: mrfry Date: Mon, 29 Mar 2021 16:25:13 +0200 Subject: [PATCH] Possible answers fix --- src/components/Question.js | 15 +++++++++++---- src/constants.json | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/Question.js b/src/components/Question.js index 57c79cb..77ea2c4 100644 --- a/src/components/Question.js +++ b/src/components/Question.js @@ -66,6 +66,13 @@ export default function Question({ question, onChange, index }) { {possibleAnswers.map((possibleAnswer, i) => { // {"text":"a. Kétismeretlenes egyenletrendszert használunk.", // "selectedByUser":true} + + console.log(possibleAnswer) + const pa = + typeof possibleAnswer === 'string' + ? possibleAnswer + : possibleAnswer.text + return (
@@ -73,15 +80,15 @@ export default function Question({ question, onChange, index }) { onChange={() => { onChange({ ...question, - A: possibleAnswer.text, + A: pa, }) }} - checked={possibleAnswer.text === question.A} - value={possibleAnswer.text} + checked={pa === question.A} + value={pa} type="radio" name={`possiblea${index ? index : ''}`} /> - {possibleAnswer.text} + {pa}
{ diff --git a/src/constants.json b/src/constants.json index cff63be..fd35ff2 100644 --- a/src/constants.json +++ b/src/constants.json @@ -1,5 +1,5 @@ { "siteUrl": "https://qmining.frylabs.net/", - "apiUrl": "http://localhost:8080/", + "apiUrl": "https://api.frylabs.net/", "maxQuestionsToRender": 250 }