отладка
This commit is contained in:
parent
1c4f15d124
commit
2e3358eb2c
@ -32,10 +32,14 @@ export function useQuizData(quizId: string, preview: boolean = false) {
|
||||
needConfig: true,
|
||||
});
|
||||
//firstData.settings.status = "ai";
|
||||
console.log("useQuizData: firstData received:", firstData);
|
||||
console.log("useQuizData: firstData.settings:", firstData.settings);
|
||||
|
||||
initDataManager({
|
||||
status: firstData.settings.status,
|
||||
haveRoot: firstData.settings.cfg.haveRoot,
|
||||
});
|
||||
console.log("useQuizData: calling setQuizData with firstData");
|
||||
setQuizData(firstData);
|
||||
|
||||
// Определяем нужно ли загружать все данные
|
||||
|
@ -72,6 +72,7 @@ function QuizAnswererInner({
|
||||
useEffect(() => {
|
||||
//Хук на случай если данные переданы нам сразу, а не "нам нужно их запросить"
|
||||
if (quizSettings !== undefined) {
|
||||
console.log("QuizAnswerer: calling setQuizData with quizSettings");
|
||||
setQuizData(quizSettings);
|
||||
initDataManager({
|
||||
status: quizSettings.settings.status,
|
||||
@ -100,6 +101,8 @@ function QuizAnswererInner({
|
||||
console.log("settings");
|
||||
console.log(settings);
|
||||
if (isLoading && !questions.length) return <LoadingSkeleton />;
|
||||
console.log("error");
|
||||
console.log(error);
|
||||
if (error) return <ApologyPage error={error} />;
|
||||
|
||||
if (Object.keys(settings).length == 0) return <ApologyPage error={new Error("quiz data is null")} />;
|
||||
|
@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
|
||||
type Props = Partial<FallbackProps>;
|
||||
|
||||
export const ApologyPage = ({ error }: Props) => {
|
||||
let message = error.message || error.response?.data;
|
||||
let message = error.message || error.response?.data || " ";
|
||||
console.log("message");
|
||||
console.log(message.toLowerCase());
|
||||
const { t } = useTranslation();
|
||||
|
@ -25,10 +25,24 @@ export const useQuizStore = create<QuizStore>(() => ({
|
||||
}));
|
||||
|
||||
export const setQuizData = (data: QuizSettings) => {
|
||||
console.log("zusstand");
|
||||
console.log(data);
|
||||
useQuizStore.setState((state: QuizStore) => ({ ...state, ...data }));
|
||||
console.log("setQuizData called with:");
|
||||
console.log("data:", data);
|
||||
console.log("data.settings:", data.settings);
|
||||
console.log("data.questions:", data.questions);
|
||||
|
||||
const currentState = useQuizStore.getState();
|
||||
console.log("Current state before update:", currentState);
|
||||
|
||||
useQuizStore.setState((state: QuizStore) => {
|
||||
const newState = { ...state, ...data };
|
||||
console.log("New state after update:", newState);
|
||||
return newState;
|
||||
});
|
||||
|
||||
const updatedState = useQuizStore.getState();
|
||||
console.log("State after setState:", updatedState);
|
||||
};
|
||||
|
||||
export const addQuestions = (newQuestions: AnyTypedQuizQuestion[]) =>
|
||||
useQuizStore.setState(
|
||||
produce((state: QuizStore) => {
|
||||
|
@ -9,6 +9,8 @@ export default defineConfig({
|
||||
alias,
|
||||
},
|
||||
build: {
|
||||
minify: false, // Отключает минификацию
|
||||
sourcemap: true, // Включает sourcemaps для отладки
|
||||
copyPublicDir: false,
|
||||
rollupOptions: {
|
||||
input: "src/widget.tsx",
|
||||
|
Loading…
Reference in New Issue
Block a user