diff --git a/src/api/quizRelase.ts b/src/api/quizRelase.ts index 735f6a6..9f92d07 100644 --- a/src/api/quizRelase.ts +++ b/src/api/quizRelase.ts @@ -16,7 +16,7 @@ export function getData(quizId: string) { export function sendAnswer({ questionId, body, qid }: any) { const formData = new FormData(); - +console.log(qid) const answers = [{ question_id: questionId, content: body, //тут массив с ответом @@ -40,7 +40,7 @@ export function sendFile({ questionId, body, qid }: any) { content: body.name, } - fd[body.name] = body.filen //target.files[0] + fd[body.name] = body.file //target.files[0] const answers = [fd] formData.append("answers", JSON.stringify(answers)); diff --git a/src/pages/ViewPublicationPage/index.tsx b/src/pages/ViewPublicationPage/index.tsx index db072d1..37260fd 100644 --- a/src/pages/ViewPublicationPage/index.tsx +++ b/src/pages/ViewPublicationPage/index.tsx @@ -18,7 +18,7 @@ const QID = process.env.NODE_ENV === "production" ? window.location.pathname.replace(/\//g, '') : - "6e96e958-d30e-49f6-aa85-32aaef975733" + "2363ad2c-0c19-4f51-80c0-ed2242daa0c4" export const ViewPage = () => { @@ -67,6 +67,19 @@ export const ViewPage = () => { //@ts-ignore cnt: data.cnt } + + + parseData.items = parseData.items.map((question:any) => { + let data = question + for (let key in question) { + if (question[key] === " ") data[key] = "" + } + return data + }) + + + + useQuestionsStore.setState(parseData) } catch (e) { diff --git a/src/pages/ViewPublicationPage/tools/replaceSpacesToEmptyLines.ts b/src/pages/ViewPublicationPage/tools/replaceSpacesToEmptyLines.ts index 3f94da6..f48a27e 100644 --- a/src/pages/ViewPublicationPage/tools/replaceSpacesToEmptyLines.ts +++ b/src/pages/ViewPublicationPage/tools/replaceSpacesToEmptyLines.ts @@ -11,7 +11,7 @@ export const replaceSpacesToEmptyLines = (object: T): T => { for (const [key, value] of Object.entries(object)) { if (typeof value === "string") { - result[key] = value.replace(/ /g, ""); + result[key] = value.replace(/\" \"/g, '""'); continue; }