diff --git a/frontend/src/components/AnswerForm.vue b/frontend/src/components/AnswerForm.vue index 87873f7..7e0fd9c 100644 --- a/frontend/src/components/AnswerForm.vue +++ b/frontend/src/components/AnswerForm.vue @@ -1,11 +1,6 @@ @@ -77,7 +76,7 @@ onMounted(() => {

- Good job! {{ response_to_answer.right_answer }} was the right answer! + Good job! "{{ response_to_answer.right_answer }}" was the right answer!

Unfortunately, your answer "{{ response_to_answer.answer_sent }}" was wrong. The correct answer was "{{ @@ -94,7 +93,7 @@ onMounted(() => {

Unfortunately, your answer "{{ response_to_answer.answer_sent }}" was wrong. The correct answer was "{{ response_to_answer.right_answer }}"

- +
diff --git a/frontend/src/views/QuizView.vue b/frontend/src/views/QuizView.vue index 17d4761..a6c81ac 100644 --- a/frontend/src/views/QuizView.vue +++ b/frontend/src/views/QuizView.vue @@ -9,12 +9,17 @@ const route = useRoute(); const id_category = route.params.id_category; // variables specific to this component -const question = ref(""); +const question = ref(null); +const hasAskedOptions = ref(false); const fetchNewQuestion = async () => { - const response = await axios.get(`/api/question/${id_category}/new`, { + const responseQuestion = await axios.get(`/api/question/${id_category}/new`, { }); - question.value = response.data.text; + question.value = responseQuestion.data.text; + + // wait for the question before checking if the user has asked for options + const responseOptionAsked = await axios.get(`/api/question/options_asked`); + hasAskedOptions.value = !!responseOptionAsked.data.options_asked; } onMounted(() => { @@ -28,8 +33,8 @@ onMounted(() => {

Answer correctly to the question and earn as many IQs as possible!

Question

{{ question }}

- - + +