Skip to content

Commit

Permalink
merge :: 공지사항 파일 nullabled 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
eejx0 authored Nov 14, 2024
2 parents a9663a5 + 00b1d28 commit 83d15a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Apis/Notices/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const useNoticeListData = () => {

useEffect(() => {
fetchNoticeList();

}, [fetchNoticeList]);

return { notices };
Expand Down
2 changes: 1 addition & 1 deletion src/Apis/Notices/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AttachmentType } from "./response";
export interface NoticeWrite {
title: string;
content: string;
attachments: AttachmentRequest[];
attachments?: AttachmentRequest[];
}

export interface NoticeEdit {
Expand Down
2 changes: 1 addition & 1 deletion src/Apis/Notices/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface NoticeDetailResponse {
title: string;
content: string;
created_at: string;
attachments: AttachmentResponse[];
attachments?: AttachmentResponse[];
}

export type AttachmentType =
Expand Down
10 changes: 8 additions & 2 deletions src/Pages/NoticePage/NoticeWritePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export function NoticeWritePage() {
const navigate = useNavigate();

const { mutate: writeNotice } = useNoticeWriteData();

const { mutate: getPresignedUrl, data } = usePresignedUrl();

useEffect(() => {
Expand Down Expand Up @@ -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')
}
};

Expand Down Expand Up @@ -136,7 +142,7 @@ export function NoticeWritePage() {
<_.FileWrap>
<_.Text>첨부파일</_.Text>
<_.AddFileWrapper>
{attachments.map(
{attachments?.map(
(file: File, index: number) => (
<_.AddFile key={index}>
{file.name}
Expand Down

0 comments on commit 83d15a8

Please sign in to comment.