Skip to content
Snippets Groups Projects
Commit 645ce5ce authored by Emil's avatar Emil
Browse files

Feat: question components, needed fix: AnswerMultiple.tsx

parent a02264d7
No related branches found
No related tags found
1 merge request!126Resolve "Show question components in editor"
Pipeline #43668 passed with warnings
......@@ -17285,7 +17285,8 @@
},
"ssri": {
"version": "6.0.1",
"resolved": "",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
"integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==",
"requires": {
"figgy-pudding": "^3.5.1"
}
......
......@@ -29,14 +29,15 @@ const AnswerMultiple = ({ variant, activeSlide, competitionId }: AnswerMultipleP
}
const updateAnswer = async (alternative: QuestionAlternative) => {
// TODO: fix. Make list of alternatives and delete & post instead of put to allow multiple boxes checked.
if (activeSlide) {
if (team?.question_answers.find((answer) => answer.question_id === activeSlide.questions[0].id)) {
console.log('CHECKKKKKKKKKKK')
if (answer?.answer === alternative.text) {
// Uncheck checkbox
deleteAnswer()
} else {
// Check another box
// TODO
}
} else {
// Check first checkbox
......@@ -60,7 +61,7 @@ const AnswerMultiple = ({ variant, activeSlide, competitionId }: AnswerMultipleP
const deleteAnswer = async () => {
await axios
.delete(`/api/competitions/${competitionId}/teams/${teamId}/answers`)
.delete(`/api/competitions/${competitionId}/teams/${teamId}/answers`) // TODO: fix
.then(() => {
dispatch(getEditorCompetition(competitionId))
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment