Skip to content

Commit c557f0b

Browse files
committed
๐Ÿ›fix: error status ๋ณ„ ์ฒ˜๋ฆฌ
1 parent 435662a commit c557f0b

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

โ€Žsrc/api/letter/letter.tsxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { authClient } from "../client";
1+
import client, { authClient } from "../client";
22

33
// ํŽธ์ง€ ์กฐํšŒ
44
export const getLetter = async (letterId: string) => {
@@ -43,7 +43,7 @@ export const uploadImage = async ({ imageUrl }: { imageUrl: string }) => {
4343

4444
// ํŽธ์ง€ ์—ด๋žŒ ๊ฐ€๋Šฅ ๊ฒ€์ฆ
4545
export const verifyLetter = async (letterCode: string) => {
46-
return await authClient.put(`/api/v1/letters/verify`, {
46+
return await client.put(`/api/v1/letters/verify`, {
4747
letterCode: letterCode,
4848
});
4949
};

โ€Žsrc/app/verify/letter/page.tsxโ€Ž

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@ const VerifyLetter = () => {
6767
};
6868

6969
useEffect(() => {
70+
//์•ก์„ธ์Šค ํ† ํฐ์ด ์—†์„ ๋•Œ ๋ฏธ๋ฆฌ ์ฒ˜๋ฆฌ
7071
if (!accessToken) {
7172
router.push(url ? `/login?url=${url}` : `/login`);
7273
return;
7374
}
74-
75+
//์•ก์„ธ์Šค ํ† ํฐ์ด ์žˆ๋‹ค๋ฉด
7576
const checkMainIdAndVerify = async () => {
7677
try {
7778
// ๋ฉ”์ธ ID ์กฐํšŒ๋ฅผ ํ†ตํ•œ ํšŒ์› ๊ฒ€์ฆ (ํƒˆํ‡ดํšŒ์› ํฌํ•จ)
@@ -87,8 +88,14 @@ const VerifyLetter = () => {
8788
}
8889
})
8990
.catch((error) => {
90-
console.error("๊ฒ€์ฆ ์‹คํŒจ:", error);
91-
router.push(`/error/letter`);
91+
if (error.status === 403) {
92+
//ํ•ด๋‹น ์‚ฌ์šฉ์ž๊ฐ€ ์—ด๋žŒ ๊ฐ€๋Šฅํ•œ ํŽธ์ง€๊ฐ€ ์•„๋‹˜
93+
console.error("๊ฒ€์ฆ ์‹คํŒจ:", error);
94+
router.push(`/error/letter`);
95+
} else if (error.status === 400) {
96+
//ํŽธ์ง€๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Œ
97+
router.push(`/error`);
98+
}
9299
});
93100
}
94101
} catch (error) {

0 commit comments

Comments
ย (0)