From 65f66ee96eeae55dcc5dc9269b6318a5d6b14abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B8=B0=EC=98=81?= Date: Mon, 29 Jul 2024 09:42:52 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20useNoticeWrite=20=ED=9B=85=20=ED=98=95?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/hooks/api/useNoticeWrite.js | 9 ++++++++- frontend/src/pages/NoticeWritePage/NoticeWritePage.jsx | 9 +-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/src/hooks/api/useNoticeWrite.js b/frontend/src/hooks/api/useNoticeWrite.js index f171ef0..afba9f8 100644 --- a/frontend/src/hooks/api/useNoticeWrite.js +++ b/frontend/src/hooks/api/useNoticeWrite.js @@ -2,7 +2,14 @@ import instance from '../../utils/axios/instance'; import { API_URL } from '../../constants'; export function useNoticeWrite() { - const noticeWrite = (newNotice) => { + const noticeWrite = (lectureId, title, content) => { + const newNotice = { + lectureId: Number(lectureId), + title, + category: 'announcement', + content, + }; + console.log(newNotice); return instance.post(`${API_URL}/board`, newNotice); }; diff --git a/frontend/src/pages/NoticeWritePage/NoticeWritePage.jsx b/frontend/src/pages/NoticeWritePage/NoticeWritePage.jsx index 01e7dad..04e7acb 100644 --- a/frontend/src/pages/NoticeWritePage/NoticeWritePage.jsx +++ b/frontend/src/pages/NoticeWritePage/NoticeWritePage.jsx @@ -10,15 +10,8 @@ export default function NoticeWritePage() { const handleSubmit = async (e, title, content) => { e.preventDefault(); - console.log('handleSubmit'); - console.log(title, content); - const response = await noticeWrite({ - lectureId: Number(lectureId), - title, - category: 'announcement', - content, - }); + const response = await noticeWrite(lectureId, title, content); console.log('response : ', response); navigate('..'); };