если не был дан ответ на вопрос - шлётся пустая строка
This commit is contained in:
parent
b28f0c840d
commit
481a8681ca
@ -97,7 +97,7 @@ export default function ViewPublicationPage() {
|
|||||||
moveToNextQuestion={() => {
|
moveToNextQuestion={() => {
|
||||||
moveToNextQuestion();
|
moveToNextQuestion();
|
||||||
|
|
||||||
if (!currentAnswer || preview) return;
|
if (preview) return;
|
||||||
|
|
||||||
sendQuestionAnswer(quizId, currentQuestion, currentAnswer)?.catch((e) => {
|
sendQuestionAnswer(quizId, currentQuestion, currentAnswer)?.catch((e) => {
|
||||||
enqueueSnackbar("Ошибка при отправке ответа");
|
enqueueSnackbar("Ошибка при отправке ответа");
|
||||||
|
@ -4,7 +4,18 @@ import { QuestionAnswer } from "@/stores/quizView";
|
|||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { notReachable } from "./notReachable";
|
import { notReachable } from "./notReachable";
|
||||||
|
|
||||||
export function sendQuestionAnswer(quizId: string, question: RealTypedQuizQuestion, questionAnswer: QuestionAnswer) {
|
export function sendQuestionAnswer(
|
||||||
|
quizId: string,
|
||||||
|
question: RealTypedQuizQuestion,
|
||||||
|
questionAnswer: QuestionAnswer | undefined
|
||||||
|
) {
|
||||||
|
if (!questionAnswer) {
|
||||||
|
return sendAnswer({
|
||||||
|
questionId: question.id,
|
||||||
|
body: "",
|
||||||
|
qid: quizId,
|
||||||
|
});
|
||||||
|
}
|
||||||
switch (question.type) {
|
switch (question.type) {
|
||||||
case "date": {
|
case "date": {
|
||||||
if (!moment.isMoment(questionAnswer.answer)) throw new Error("Cannot send answer in date question");
|
if (!moment.isMoment(questionAnswer.answer)) throw new Error("Cannot send answer in date question");
|
||||||
|
Loading…
Reference in New Issue
Block a user