автоотправка заявки если нет ФК
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 { quizThemes } from "@utils/themes/Publication/themePublication";
|
||||||
|
|
||||||
import { DESIGN_LIST } from "@/utils/designList";
|
import { DESIGN_LIST } from "@/utils/designList";
|
||||||
import type { ReactNode } from "react";
|
import { type ReactNode } from "react";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
currentQuestion: RealTypedQuizQuestion;
|
currentQuestion: RealTypedQuizQuestion;
|
||||||
@ -123,7 +123,11 @@ export const Question = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
{questionSelect}
|
{questionSelect}
|
||||||
<Footer stepNumber={currentQuestionStepNumber} prevButton={prevButton} nextButton={nextButton} />
|
<Footer
|
||||||
|
stepNumber={currentQuestionStepNumber}
|
||||||
|
prevButton={prevButton}
|
||||||
|
nextButton={nextButton}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
@ -140,7 +144,12 @@ function QuestionByType({ question, stepNumber }: { question: RealTypedQuizQuest
|
|||||||
case "emoji":
|
case "emoji":
|
||||||
return <Emoji currentQuestion={question} />;
|
return <Emoji currentQuestion={question} />;
|
||||||
case "text":
|
case "text":
|
||||||
return <Text currentQuestion={question} stepNumber={stepNumber} />;
|
return (
|
||||||
|
<Text
|
||||||
|
currentQuestion={question}
|
||||||
|
stepNumber={stepNumber}
|
||||||
|
/>
|
||||||
|
);
|
||||||
case "select":
|
case "select":
|
||||||
return <Select currentQuestion={question} />;
|
return <Select currentQuestion={question} />;
|
||||||
case "date":
|
case "date":
|
||||||
|
@ -16,6 +16,8 @@ import type { QuizQuestionResult } from "@/model/questionTypes/result";
|
|||||||
import QuizVideo from "@/ui_kit/VideoIframe/VideoIframe";
|
import QuizVideo from "@/ui_kit/VideoIframe/VideoIframe";
|
||||||
import { TextAccordion } from "./tools/TextAccordion";
|
import { TextAccordion } from "./tools/TextAccordion";
|
||||||
import { PointSystemResultList } from "./PointSystemResultList";
|
import { PointSystemResultList } from "./PointSystemResultList";
|
||||||
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
import { sendFC } from "@/api/quizRelase";
|
||||||
|
|
||||||
type ResultFormProps = {
|
type ResultFormProps = {
|
||||||
resultQuestion: QuizQuestionResult;
|
resultQuestion: QuizQuestionResult;
|
||||||
@ -25,7 +27,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useRootContainerSize() < 650;
|
const isMobile = useRootContainerSize() < 650;
|
||||||
const isTablet = useRootContainerSize() < 1000;
|
const isTablet = useRootContainerSize() < 1000;
|
||||||
const { settings, show_badge, quizId } = useQuizSettings();
|
const { settings, show_badge, quizId, preview } = useQuizSettings();
|
||||||
const setCurrentQuizStep = useQuizViewStore((state) => state.setCurrentQuizStep);
|
const setCurrentQuizStep = useQuizViewStore((state) => state.setCurrentQuizStep);
|
||||||
const spec = settings.cfg.spec;
|
const spec = settings.cfg.spec;
|
||||||
const vkMetrics = useVkMetricsGoals(settings.cfg.vkMetricsNumber);
|
const vkMetrics = useVkMetricsGoals(settings.cfg.vkMetricsNumber);
|
||||||
@ -36,6 +38,26 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
|
|||||||
yandexMetrics.resultIdShown(resultQuestion.id);
|
yandexMetrics.resultIdShown(resultQuestion.id);
|
||||||
}, [resultQuestion.id, vkMetrics, yandexMetrics]);
|
}, [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 (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
Loading…
Reference in New Issue
Block a user