отправка пустого ответа при пропуске вопроса
This commit is contained in:
parent
118f05439e
commit
a0dd7f0891
@ -12,9 +12,12 @@ import { ResultForm } from "./ResultForm";
|
||||
import { StartPageViewPublication } from "./StartPageViewPublication";
|
||||
import PrevButton from "./tools/PrevButton";
|
||||
import NextButton from "./tools/NextButton";
|
||||
import {enqueueSnackbar} from "notistack";
|
||||
import { sendAnswer } from "@api/quizRelase";
|
||||
|
||||
export default function ViewPublicationPage() {
|
||||
const { settings, recentlyCompleted } = useQuizData();
|
||||
const { settings, recentlyCompleted, quizId } = useQuizData();
|
||||
const { answers } = useQuizViewStore();
|
||||
let currentQuizStep = useQuizViewStore((state) => state.currentQuizStep);
|
||||
const isMobileMini = useRootContainerSize() < 382;
|
||||
const {
|
||||
@ -27,6 +30,8 @@ export default function ViewPublicationPage() {
|
||||
showResultAfterContactForm,
|
||||
} = useQuestionFlowControl();
|
||||
|
||||
const isAnswer = answers.some(ans => ans.questionId === currentQuestion.id)
|
||||
|
||||
useEffect(
|
||||
function setFaviconAndTitle() {
|
||||
const link = document.querySelector('link[rel="icon"]');
|
||||
@ -60,7 +65,24 @@ export default function ViewPublicationPage() {
|
||||
currentQuestion={currentQuestion}
|
||||
currentQuestionStepNumber={currentQuestionStepNumber}
|
||||
prevButton={ <PrevButton isPreviousButtonEnabled={isPreviousButtonEnabled} moveToPrevQuestion={moveToPrevQuestion}/>}
|
||||
nextButton={<NextButton isNextButtonEnabled={isNextButtonEnabled} moveToNextQuestion={moveToNextQuestion}/>}
|
||||
nextButton={
|
||||
<NextButton
|
||||
isNextButtonEnabled={isNextButtonEnabled}
|
||||
moveToNextQuestion={async () => {
|
||||
if (!isAnswer) {
|
||||
try {
|
||||
await sendAnswer({
|
||||
questionId: currentQuestion.id,
|
||||
body: "",
|
||||
qid: quizId,
|
||||
});
|
||||
} catch (e) {
|
||||
enqueueSnackbar("ответ не был засчитан");
|
||||
}
|
||||
}
|
||||
moveToNextQuestion()
|
||||
}}
|
||||
/>}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user