fix: 2 bugs

This commit is contained in:
IlyaDoronin 2023-10-09 11:33:46 +03:00
parent 81fd62c85b
commit 9aa6fbf411
2 changed files with 6 additions and 5 deletions

@ -129,9 +129,9 @@ export const ChooseAnswerModal = ({
onClick={() => {
setOpenModal(false);
const question = listQuestions[quizId][totalIndex];
const question = { ...listQuestions[quizId][totalIndex] };
removeQuestionForce(quizId, totalIndex);
removeQuestionForce(quizId, question.id);
createQuestion(quizId, selectedValue, totalIndex);
updateQuestionsList<QuizQuestionBase>(quizId, totalIndex, {
expanded: question.expanded,

@ -17,7 +17,7 @@ import {
questionStore,
updateQuestionsList,
createQuestion,
removeQuestion,
removeQuestionForce,
} from "@root/questions";
import type {
@ -110,12 +110,13 @@ export default function TypeQuestions({ totalIndex }: Props) {
<QuestionsMiniButton
key={title}
onClick={() => {
const question = listQuestions[quizId][totalIndex];
const question = { ...listQuestions[quizId][totalIndex] };
removeQuestion(quizId, totalIndex);
removeQuestionForce(quizId, question.id);
createQuestion(quizId, value, totalIndex);
updateQuestionsList<QuizQuestionBase>(quizId, totalIndex, {
expanded: question.expanded,
type: value,
});
}}
icon={icon}