diff --git a/src/pages/Questions/Branching/QuestionSwitchWindowTool.tsx b/src/pages/Questions/Branching/QuestionSwitchWindowTool.tsx index 9e3c4eb5..ea3aef97 100644 --- a/src/pages/Questions/Branching/QuestionSwitchWindowTool.tsx +++ b/src/pages/Questions/Branching/QuestionSwitchWindowTool.tsx @@ -3,7 +3,11 @@ import { deleteTimeoutedQuestions } from "@utils/deleteTimeoutedQuestions"; import { lazy, Suspense, useCallback } from "react"; import { DraggableList } from "../DraggableList"; import { SwitchBranchingPanel } from "./SwitchBranchingPanel"; - +import { useQuestions } from "@/stores/questions/hooks"; +import { uploadQuestionImage } from "@/stores/questions/actions"; +import { useCurrentQuiz } from "@/stores/quizes/hooks"; +let params = (new URL(document.location)).searchParams; +console.log(params.get("data")); const BranchingMap = lazy(() => import("./BranchingMap").then((module) => ({ default: module.BranchingMap })), ); @@ -28,6 +32,8 @@ export const QuestionSwitchWindowTool = ({ } setOpenBranchingPage(!openBranchingPage); }, [openBranchingPage, setOpenBranchingPage]); + const { isLoading, questions } = useQuestions(); + const quiz = useCurrentQuiz(); return ( + {params.get("data") === "a" && { + console.log(e) + Array.from(e.target.files).forEach((element, i) => { + setTimeout(() => { + console.log(i) + console.log(Number(element.name.replace(/[^0-9,\s]/g, ""))) + const q = questions.find((q) => q.page + 1 === Number(element.name.replace(/[^0-9,\s]/g, ""))) + if (q !== undefined) { + console.log(q) + console.log("-----------------") + uploadQuestionImage( + q.id, + quiz.qid, + e.target.files[i], + (question, url) => { + question.content.back = url; + question.content.originalBack = url; + }, + ); + } + }, 1000); + }); + }} + /> + } {openBranchingPage ? (