diff --git a/app/API/lecture.ts b/app/API/lecture.ts index 0d2adf6..fb66da0 100644 --- a/app/API/lecture.ts +++ b/app/API/lecture.ts @@ -283,6 +283,8 @@ export async function addUserInLecture( const data = await response.json(); switch (response.status) { + case 400: + throw new BadRequestError("입력값 검증 실패"); case 401: handle401(); break; @@ -320,6 +322,8 @@ export async function addUsersInLecture( }); const data = await response.json(); switch (response.status) { + case 400: + throw new BadRequestError(data.message); case 401: handle401(); break; @@ -353,8 +357,6 @@ export async function removeUserInLecture( } ); - const data = await response.json(); - switch (response.status) { case 401: handle401(); @@ -370,7 +372,10 @@ export async function removeUserInLecture( "서버 에러가 발생했습니다. 관리자에게 문의해 주세요" ); } - return data; + + if (response.status === 204) return {}; + + return await response.json(); } export async function getUsersInLecture( diff --git a/app/routes/_procted+/students+/$lectureId+/Table.tsx b/app/routes/_procted+/students+/$lectureId+/Table.tsx index 3da48ff..8d7603e 100644 --- a/app/routes/_procted+/students+/$lectureId+/Table.tsx +++ b/app/routes/_procted+/students+/$lectureId+/Table.tsx @@ -223,7 +223,6 @@ const TableHeader = () => { isOpen={isUserAddModalOpen} onClose={() => { setIsUserAddModalOpen(false); - window.location.reload(); }} /> </div> diff --git a/app/util/xlsx.ts b/app/util/xlsx.ts index b93fe70..dff6ad3 100644 --- a/app/util/xlsx.ts +++ b/app/util/xlsx.ts @@ -25,7 +25,7 @@ export async function parseXlsx(file: File): Promise<studentRow[]> { for (let i = 0; i < listLength; ++i) { ret.push({ userId: idList[i], - userName: nameList[i], + userName: nameList[i] + "", isTutor: isTutorList[i], }); }