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

Commit

Permalink
fix(student manage) : appropriate handle for errors
Browse files Browse the repository at this point in the history
- 이름 string으로 강제
- 400시 toast 뱉음
  • Loading branch information
kasterra committed May 24, 2024
1 parent 6e4d020 commit 62f30d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
11 changes: 8 additions & 3 deletions app/API/lecture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -353,8 +357,6 @@ export async function removeUserInLecture(
}
);

const data = await response.json();

switch (response.status) {
case 401:
handle401();
Expand All @@ -370,7 +372,10 @@ export async function removeUserInLecture(
"서버 에러가 발생했습니다. 관리자에게 문의해 주세요"
);
}
return data;

if (response.status === 204) return {};

return await response.json();
}

export async function getUsersInLecture(
Expand Down
1 change: 0 additions & 1 deletion app/routes/_procted+/students+/$lectureId+/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ const TableHeader = () => {
isOpen={isUserAddModalOpen}
onClose={() => {
setIsUserAddModalOpen(false);
window.location.reload();
}}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/util/xlsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
});
}
Expand Down

0 comments on commit 62f30d3

Please sign in to comment.