автоотправка заявки если нет ФК
This commit is contained in:
parent
dc327ca1dd
commit
0dfa011cb1
@ -22,7 +22,7 @@ import { notReachable } from "@utils/notReachable";
|
||||
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
||||
|
||||
import { DESIGN_LIST } from "@/utils/designList";
|
||||
import type { ReactNode } from "react";
|
||||
import { type ReactNode } from "react";
|
||||
|
||||
type Props = {
|
||||
currentQuestion: RealTypedQuizQuestion;
|
||||
@ -123,7 +123,11 @@ export const Question = ({
|
||||
</Box>
|
||||
</Box>
|
||||
{questionSelect}
|
||||
<Footer stepNumber={currentQuestionStepNumber} prevButton={prevButton} nextButton={nextButton} />
|
||||
<Footer
|
||||
stepNumber={currentQuestionStepNumber}
|
||||
prevButton={prevButton}
|
||||
nextButton={nextButton}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
@ -140,7 +144,12 @@ function QuestionByType({ question, stepNumber }: { question: RealTypedQuizQuest
|
||||
case "emoji":
|
||||
return <Emoji currentQuestion={question} />;
|
||||
case "text":
|
||||
return <Text currentQuestion={question} stepNumber={stepNumber} />;
|
||||
return (
|
||||
<Text
|
||||
currentQuestion={question}
|
||||
stepNumber={stepNumber}
|
||||
/>
|
||||
);
|
||||
case "select":
|
||||
return <Select currentQuestion={question} />;
|
||||
case "date":
|
||||
|
@ -16,6 +16,8 @@ import type { QuizQuestionResult } from "@/model/questionTypes/result";
|
||||
import QuizVideo from "@/ui_kit/VideoIframe/VideoIframe";
|
||||
import { TextAccordion } from "./tools/TextAccordion";
|
||||
import { PointSystemResultList } from "./PointSystemResultList";
|
||||
import { enqueueSnackbar } from "notistack";
|
||||
import { sendFC } from "@/api/quizRelase";
|
||||
|
||||
type ResultFormProps = {
|
||||
resultQuestion: QuizQuestionResult;
|
||||
@ -25,7 +27,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
||||
const theme = useTheme();
|
||||
const isMobile = useRootContainerSize() < 650;
|
||||
const isTablet = useRootContainerSize() < 1000;
|
||||
const { settings, show_badge, quizId } = useQuizSettings();
|
||||
const { settings, show_badge, quizId, preview } = useQuizSettings();
|
||||
const setCurrentQuizStep = useQuizViewStore((state) => state.setCurrentQuizStep);
|
||||
const spec = settings.cfg.spec;
|
||||
const vkMetrics = useVkMetricsGoals(settings.cfg.vkMetricsNumber);
|
||||
@ -36,6 +38,26 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
||||
yandexMetrics.resultIdShown(resultQuestion.id);
|
||||
}, [resultQuestion.id, vkMetrics, yandexMetrics]);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
if (!settings.cfg.showfc) {
|
||||
try {
|
||||
await sendFC({
|
||||
questionId: resultQuestion.id,
|
||||
body: {},
|
||||
qid: quizId,
|
||||
preview,
|
||||
});
|
||||
|
||||
const sessions = JSON.parse(localStorage.getItem("sessions") || "{}");
|
||||
localStorage.setItem("sessions", JSON.stringify({ ...sessions, [quizId]: new Date().getTime() }));
|
||||
} catch (e) {
|
||||
enqueueSnackbar("Заявка не может быть отправлена");
|
||||
}
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
|
Loading…
Reference in New Issue
Block a user