From 1aede3a745ce997ce49b2593de5a97dc3c5aa2f1 Mon Sep 17 00:00:00 2001 From: hyuna Date: Sun, 14 Jul 2024 18:42:19 +0900 Subject: [PATCH 1/5] =?UTF-8?q?chore=20:=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=89=AC=ED=86=A0=ED=81=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 38 ++++++++++++++------------------------ src/hook/errorHandling.ts | 5 +---- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 9bd3841..1eca8c3 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,40 +37,30 @@ refreshInstance.interceptors.request.use( instance.interceptors.response.use( (response) => response, - async (error: AxiosError) => { + async (error: AxiosError) => { if (axios.isAxiosError(error) && error.response) { - const { status } = error.response.data; + const { status } = error.response; if (status === 401) { const refreshToken = cookie.get("refresh_token"); if (refreshToken) { try { - const res = await axios.put( - `${BASEURL}/refresh`, - {}, - { + await axios + .put(`${BASEURL}/admin/refresh`, null, { headers: { - "X-Refresh-Token": `Bearer ${refreshToken}`, + "X-Refresh-Token": `${refreshToken}`, }, - } - ); - const { data } = res.data; - const accessToken = data.accessToken; - cookie.set("access_token", accessToken); - if (error.config) { - error.config.headers.Authorization = `Bearer ${accessToken}`; - return axios.request(error.config); - } - } catch { - throw error; + }) + .then((response) => { + const data = response.data; + cookie.set("access_token", data.access_token); + cookie.set("refresh_token", data.refresh_token); + }); + } catch (refreshError) { + return Promise.reject(refreshError); } - } else { - throw error; } - } else { - throw error; } - } else { - throw error; } + return Promise.reject(error); } ); diff --git a/src/hook/errorHandling.ts b/src/hook/errorHandling.ts index e09c1cd..2410e2f 100644 --- a/src/hook/errorHandling.ts +++ b/src/hook/errorHandling.ts @@ -8,14 +8,11 @@ type HandleType = { }; const apiError = () => { - const router = useRouter(); const handle400: ErrorHandler = () => { alert("400 잘못된 요청입니다"); }; - const handle401: ErrorHandler = () => { - router.push("login"); - }; + const handle401: ErrorHandler = () => {}; const handle403: ErrorHandler = () => { alert("403 권한이 없습니다"); From 9e4f64bd43760ce85c5cd7aada71d2c2e733b7bd Mon Sep 17 00:00:00 2001 From: hyuna Date: Sun, 14 Jul 2024 20:48:56 +0900 Subject: [PATCH 2/5] chore : errorhandle --- src/api/bug/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/bug/index.ts b/src/api/bug/index.ts index a3a6eba..71125a2 100644 --- a/src/api/bug/index.ts +++ b/src/api/bug/index.ts @@ -5,7 +5,7 @@ import apiError from "@/hook/errorHandling"; interface BugProp { title: string; content: string; - file_name: string; + file_name: string[]; } export const BugPost = () => { @@ -16,6 +16,7 @@ export const BugPost = () => { await instance.post(`/bug/message`, { title: param.title, content: param.content, + model: "WEB", file_name: param.file_name, }); } catch (error) { From 5f139a5780866e4727c8520e539b5db999fbf759 Mon Sep 17 00:00:00 2001 From: hyuna Date: Sun, 14 Jul 2024 23:16:51 +0900 Subject: [PATCH 3/5] =?UTF-8?q?chore=20:=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/main/checkPage.tsx | 2 +- src/hook/errorHandling.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/main/checkPage.tsx b/src/components/main/checkPage.tsx index 1334a2b..36704a4 100644 --- a/src/components/main/checkPage.tsx +++ b/src/components/main/checkPage.tsx @@ -32,7 +32,7 @@ const CheckPage = ({ type }: checkPageType) => { {type === "outGoing" ? (
- 현재 외출 중인 학생은 총 + 현재 외출/조기귀가 중인 학생은 총 {list.out}명입니다.
diff --git a/src/hook/errorHandling.ts b/src/hook/errorHandling.ts index 2410e2f..e09c1cd 100644 --- a/src/hook/errorHandling.ts +++ b/src/hook/errorHandling.ts @@ -8,11 +8,14 @@ type HandleType = { }; const apiError = () => { + const router = useRouter(); const handle400: ErrorHandler = () => { alert("400 잘못된 요청입니다"); }; - const handle401: ErrorHandler = () => {}; + const handle401: ErrorHandler = () => { + router.push("login"); + }; const handle403: ErrorHandler = () => { alert("403 권한이 없습니다"); From 0536fc49f1fb3acd67a2aa0dd9dc300b29dba1f1 Mon Sep 17 00:00:00 2001 From: hyuna Date: Mon, 29 Jul 2024 16:38:56 +0900 Subject: [PATCH 4/5] =?UTF-8?q?add=20:=20=EC=B7=A8=EC=97=85=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/bug/index.ts | 2 +- src/app/classChange/status/page.tsx | 19 ++++++++----------- src/components/dropdown/status.tsx | 9 ++++++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/api/bug/index.ts b/src/api/bug/index.ts index 71125a2..c03e687 100644 --- a/src/api/bug/index.ts +++ b/src/api/bug/index.ts @@ -5,7 +5,7 @@ import apiError from "@/hook/errorHandling"; interface BugProp { title: string; content: string; - file_name: string[]; + file_name: string; } export const BugPost = () => { diff --git a/src/app/classChange/status/page.tsx b/src/app/classChange/status/page.tsx index a8d51fd..72925a6 100644 --- a/src/app/classChange/status/page.tsx +++ b/src/app/classChange/status/page.tsx @@ -25,17 +25,14 @@ const ClassChangeOk = () => { const ChangeClassDataFloor = async () => { try { if (selectedFloor) { - await changelistFloorMutate( - { floor: selectedFloor }, - { - onSuccess: (data) => { - setFloorData(data); - }, - onError: (error) => { - console.log(error); - }, - } - ); + await changelistFloorMutate(selectedFloor, { + onSuccess: (data) => { + setFloorData(data); + }, + onError: (error) => { + console.log(error); + }, + }); } } catch (error) { console.log(error); diff --git a/src/components/dropdown/status.tsx b/src/components/dropdown/status.tsx index 130da5d..97fe8ca 100644 --- a/src/components/dropdown/status.tsx +++ b/src/components/dropdown/status.tsx @@ -41,7 +41,10 @@ const AfterCheck: React.FC = ({ state, onChange, type }) => { case "외출": return "border border-primary-500 text-primary-500"; case "이동": - return "border border border-tertiary-300 text-tertiary-300"; + return "border border-tertiary-300 text-tertiary-300"; + case "취업": + case "현체": + return "border border-neutral-500 text-neutral-500"; default: return ""; } @@ -75,9 +78,9 @@ const AfterCheck: React.FC = ({ state, onChange, type }) => { setIsDropdownVisible(false); }; - return state === "현체" ? ( + return state === "현체" || state === "취업" ? (
{selectedOption}
From 13391ced3ce539d8e5d65c9ddd40cf756796c5b4 Mon Sep 17 00:00:00 2001 From: hyuna Date: Mon, 29 Jul 2024 16:42:17 +0900 Subject: [PATCH 5/5] =?UTF-8?q?CHORE=20:=20=EB=B9=8C=EB=93=9C=EC=98=A4?= =?UTF-8?q?=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/classChange/status/page.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/app/classChange/status/page.tsx b/src/app/classChange/status/page.tsx index 72925a6..a8d51fd 100644 --- a/src/app/classChange/status/page.tsx +++ b/src/app/classChange/status/page.tsx @@ -25,14 +25,17 @@ const ClassChangeOk = () => { const ChangeClassDataFloor = async () => { try { if (selectedFloor) { - await changelistFloorMutate(selectedFloor, { - onSuccess: (data) => { - setFloorData(data); - }, - onError: (error) => { - console.log(error); - }, - }); + await changelistFloorMutate( + { floor: selectedFloor }, + { + onSuccess: (data) => { + setFloorData(data); + }, + onError: (error) => { + console.log(error); + }, + } + ); } } catch (error) { console.log(error);