Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
fix(problemEditModal) : validate update codeHole logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kasterra committed May 24, 2024
1 parent 11d4268 commit d607aad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/API/problem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<EmptyResponse> {
if (0 > memory_limit || memory_limit > 4096) {
throw new BadRequestError("메모리 제한은 0 ~ 4096 사이 값을 넣어야 합니다");
Expand All @@ -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: {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ const ProblemEditModal = ({ isOpen, onClose, editingProblemId }: Props) => {
newFilePath.length
? newFilePath
: prevProblemInfo!.file_path,
holes
holes,
language
),
{
loading: "문제를 수정하는중...",
Expand Down

0 comments on commit d607aad

Please sign in to comment.