AnswerApi and CompletionApi
This commit is contained in:
parent
2d129c0493
commit
88dcb63232
9 changed files with 195 additions and 102 deletions
|
|
@ -6,7 +6,7 @@ import {useOutletContext} from "react-router-dom";
|
|||
import { addNewQuestion, getListQuestions, updateQuestion, deleteQuestion } from "../../api/QuestionApi.ts";
|
||||
import styles from "./SurveyPage.module.css";
|
||||
import SaveButton from "../SaveButton/SaveButton.tsx";
|
||||
import { addNewAnswerVariant, deleteAnswerVariant, getAnswerVariants, IAnswerVariant, updateAnswerVariant } from "../../api/AnswerApi.ts";
|
||||
import { addNewAnswerVariant, deleteAnswerVariant, getAnswerVariants, IAnswerVariant, updateAnswerVariant } from "../../api/AnswerVariantsApi.ts";
|
||||
|
||||
type ActionType =
|
||||
| 'update-survey'
|
||||
|
|
@ -118,14 +118,14 @@ class ActionQueue {
|
|||
}
|
||||
|
||||
private async handleUpdateQuestion(data: QuestionActionData & { id: number }) {
|
||||
return await updateQuestion(data.surveyId, data.id, {
|
||||
return await updateQuestion(data.id, {
|
||||
title: data.title,
|
||||
questionType: data.questionType
|
||||
});
|
||||
}
|
||||
|
||||
private async handleDeleteQuestion(data: QuestionActionData & { id: number }) {
|
||||
return await deleteQuestion(data.surveyId, data.id);
|
||||
return await deleteQuestion(data.id);
|
||||
}
|
||||
|
||||
private async handleCreateAnswer(data: AnswerActionData) {
|
||||
|
|
@ -136,7 +136,7 @@ class ActionQueue {
|
|||
|
||||
private async handleUpdateAnswer(data: AnswerActionData & { id: number }) {
|
||||
try {
|
||||
const result = await updateAnswerVariant(data.surveyId, data.questionId, data.id, {
|
||||
const result = await updateAnswerVariant(data.id, {
|
||||
text: data.text
|
||||
});
|
||||
return result;
|
||||
|
|
@ -148,7 +148,7 @@ class ActionQueue {
|
|||
}
|
||||
|
||||
private async handleDeleteAnswer(data: AnswerActionData & { id: number }) {
|
||||
return await deleteAnswerVariant(data.surveyId, data.questionId, data.id);
|
||||
return await deleteAnswerVariant(data.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue