From d607aad7e6ffc32196a2425c3ed4dc7cc4b9226e Mon Sep 17 00:00:00 2001 From: kasterra Date: Fri, 24 May 2024 18:51:10 +0900 Subject: [PATCH] fix(problemEditModal) : validate update codeHole logic --- app/API/problem.ts | 6 ++++-- .../lectures+/$lectureId+/_layout/ProblemEditModal.tsx | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/API/problem.ts b/app/API/problem.ts index 3244c67..d1539da 100644 --- a/app/API/problem.ts +++ b/app/API/problem.ts @@ -115,7 +115,8 @@ export async function updateProblem( title: string, token: string, file_path: string, - parsed_code_elements?: parsedCodeElement[][] + parsed_code_elements?: parsedCodeElement[][], + language?: string ): Promise { if (0 > memory_limit || memory_limit > 4096) { throw new BadRequestError("메모리 제한은 0 ~ 4096 사이 값을 넣어야 합니다"); @@ -131,6 +132,7 @@ export async function updateProblem( throw new BadRequestError("빈칸 문제에는 빈칸정보가 필요합니다"); } } + console.log(parsed_code_elements); const response = await fetch(`${API_SERVER_URL}/problem/${problemId}`, { method: "PUT", headers: { @@ -140,7 +142,7 @@ export async function updateProblem( body: JSON.stringify({ file_path, memory_limit, - ...(parsed_code_elements ? { parsed_code_elements } : {}), + ...(parsed_code_elements ? { data: parsed_code_elements, language } : {}), time_limit, title, type: problemType, diff --git a/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemEditModal.tsx b/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemEditModal.tsx index 9ff9aca..97149c9 100644 --- a/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemEditModal.tsx +++ b/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemEditModal.tsx @@ -113,7 +113,8 @@ const ProblemEditModal = ({ isOpen, onClose, editingProblemId }: Props) => { newFilePath.length ? newFilePath : prevProblemInfo!.file_path, - holes + holes, + language ), { loading: "문제를 수정하는중...",