From 00b1d288512b0765c10556fa3a00cacedae5d128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9D=98=EC=A7=84?= Date: Thu, 14 Nov 2024 16:52:46 +0900 Subject: [PATCH] =?UTF-8?q?chore=20::=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=ED=8C=8C=EC=9D=BC=20nullabled=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Apis/Notices/index.ts | 1 + src/Apis/Notices/request.ts | 2 +- src/Apis/Notices/response.ts | 2 +- src/Pages/NoticePage/NoticeWritePage/index.tsx | 10 ++++++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Apis/Notices/index.ts b/src/Apis/Notices/index.ts index b532cec..e49031c 100644 --- a/src/Apis/Notices/index.ts +++ b/src/Apis/Notices/index.ts @@ -120,6 +120,7 @@ export const useNoticeListData = () => { useEffect(() => { fetchNoticeList(); + }, [fetchNoticeList]); return { notices }; diff --git a/src/Apis/Notices/request.ts b/src/Apis/Notices/request.ts index 07ef2fe..e51eb26 100644 --- a/src/Apis/Notices/request.ts +++ b/src/Apis/Notices/request.ts @@ -3,7 +3,7 @@ import { AttachmentType } from "./response"; export interface NoticeWrite { title: string; content: string; - attachments: AttachmentRequest[]; + attachments?: AttachmentRequest[]; } export interface NoticeEdit { diff --git a/src/Apis/Notices/response.ts b/src/Apis/Notices/response.ts index c6fcb03..56d2e55 100644 --- a/src/Apis/Notices/response.ts +++ b/src/Apis/Notices/response.ts @@ -8,7 +8,7 @@ export interface NoticeDetailResponse { title: string; content: string; created_at: string; - attachments: AttachmentResponse[]; + attachments?: AttachmentResponse[]; } export type AttachmentType = diff --git a/src/Pages/NoticePage/NoticeWritePage/index.tsx b/src/Pages/NoticePage/NoticeWritePage/index.tsx index e20e78a..158a95d 100644 --- a/src/Pages/NoticePage/NoticeWritePage/index.tsx +++ b/src/Pages/NoticePage/NoticeWritePage/index.tsx @@ -18,7 +18,6 @@ export function NoticeWritePage() { const navigate = useNavigate(); const { mutate: writeNotice } = useNoticeWriteData(); - const { mutate: getPresignedUrl, data } = usePresignedUrl(); useEffect(() => { @@ -91,6 +90,13 @@ export function NoticeWritePage() { const handleNoticeSubmit = () => { if (attachments.length > 0) { getPresignedUrl(attachments); + } else { + writeNotice({ + title, + content, + attachments: [{url: '', type: 'FILE'}], + }); + navigate('/Notice') } }; @@ -136,7 +142,7 @@ export function NoticeWritePage() { <_.FileWrap> <_.Text>첨부파일 <_.AddFileWrapper> - {attachments.map( + {attachments?.map( (file: File, index: number) => ( <_.AddFile key={index}> {file.name}