Skip to content

Commit

Permalink
feat : 메세지 등록 에러 메세지 세분화
Browse files Browse the repository at this point in the history
  • Loading branch information
kangjuhyup committed Oct 10, 2024
1 parent 9342a19 commit c709954
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/common/component/error/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const GlobalError = () => {
return (
<Notification
pos="fixed"
withBorder
bottom={10}
right={10}
icon={xIcon}
Expand Down
5 changes: 2 additions & 3 deletions src/pages/board/hook/rest/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const useComment = () => {
const addComment = async (body: AddCommentRequest) => {
setAddResponse(false);
setLoading(true);
console.log(body);
try {
const response = await fetch(
import.meta.env.VITE_INTRO_API_URL + "/comment",
Expand All @@ -79,12 +78,12 @@ const useComment = () => {
},
}
);
const result = await response.json();

if (!response.ok) {
throw new Error("댓글 등록 실패.");
throw new Error(result.error?.message || "댓글 등록 실패.");
}

await response.json();
setAddResponse(true);
} catch (error) {
setError((error as Error).message);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.app.tsbuildinfo
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"root":["./src/App.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/common/component/index.ts","./src/common/component/card/index.tsx","./src/common/component/header/index.tsx","./src/common/component/input/lettercount/index.tsx","./src/common/component/input/tooltip/index.tsx","./src/common/http/httpclient.ts","./src/common/http/response.ts","./src/pages/board/index.tsx","./src/pages/board/component/comment/index.tsx","./src/pages/board/component/input/index.tsx","./src/pages/board/hook/useAvartar.ts","./src/pages/board/hook/useInput.ts","./src/pages/board/hook/useList.ts","./src/pages/board/hook/rest/comment.ts","./src/pages/career/index.tsx","./src/pages/career/component/timeline/index.tsx","./src/pages/career/component/walk/index.tsx","./src/pages/career/hook/walk.ts","./src/pages/profile/index.tsx","./src/pages/profile/component/blog/index.tsx","./src/pages/profile/component/github/index.tsx","./src/pages/profile/component/info/index.tsx","./src/pages/profile/hook/rest/github.ts","./src/pages/profile/hook/rest/medium.ts","./src/pages/skill/index.tsx"],"version":"5.6.2"}
{"root":["./src/App.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/common/component/index.ts","./src/common/component/card/index.tsx","./src/common/component/error/index.tsx","./src/common/component/header/index.tsx","./src/common/component/input/lettercount/index.tsx","./src/common/component/input/tooltip/index.tsx","./src/common/http/httpclient.ts","./src/common/http/response.ts","./src/pages/board/index.tsx","./src/pages/board/component/comment/index.tsx","./src/pages/board/component/input/index.tsx","./src/pages/board/hook/useAvartar.ts","./src/pages/board/hook/useInput.ts","./src/pages/board/hook/useList.ts","./src/pages/board/hook/rest/comment.ts","./src/pages/career/index.tsx","./src/pages/career/component/timeline/index.tsx","./src/pages/career/component/walk/index.tsx","./src/pages/career/hook/walk.ts","./src/pages/profile/index.tsx","./src/pages/profile/component/blog/index.tsx","./src/pages/profile/component/github/index.tsx","./src/pages/profile/component/info/index.tsx","./src/pages/profile/hook/rest/github.ts","./src/pages/profile/hook/rest/medium.ts","./src/pages/skill/index.tsx","./src/store/useError.ts"],"version":"5.6.2"}

0 comments on commit c709954

Please sign in to comment.