From ae1299d34dad6fdfdd2fc5d13bb0c58c9064e81a Mon Sep 17 00:00:00 2001 From: Seok93 Date: Fri, 27 Sep 2024 21:53:18 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20#115=20=ED=8C=8C=EC=9D=BC=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=84=B1=EA=B3=B5=EC=9D=80=20=EB=AC=B6?= =?UTF-8?q?=EC=96=B4=EC=84=9C,=20=EC=8B=A4=ED=8C=A8=EB=8A=94=20=EA=B0=9C?= =?UTF-8?q?=EB=B3=84=20=EB=A9=94=EC=84=B8=EC=A7=80=20=EB=85=B8=EC=B6=9C?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/modal/task/CreateModalTask.tsx | 10 +--------- src/hooks/query/useTaskQuery.ts | 3 ++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/components/modal/task/CreateModalTask.tsx b/src/components/modal/task/CreateModalTask.tsx index bce9d63c..3c93ed4d 100644 --- a/src/components/modal/task/CreateModalTask.tsx +++ b/src/components/modal/task/CreateModalTask.tsx @@ -56,15 +56,7 @@ export default function CreateModalTask({ project, onClose: handleClose }: Creat else rejectedFileList.push(result); }); - if (fulfilledFileList.length > 0) { - const fulfilledFilesName = fulfilledFileList.map((result) => result.file.name).join(', '); - toastSuccess(`${fulfilledFilesName} 파일 업로드에 성공했습니다.`); - } - - if (rejectedFileList.length > 0) { - const rejectedFilesName = rejectedFileList.map((result) => result.file.name).join(', '); - toastError(`${rejectedFilesName} 파일 업로드에 실패했습니다.`); - } + if (fulfilledFileList.length > 0) toastSuccess(`${fulfilledFileList.length}개의 파일 업로드에 성공했습니다.`); }; const handleSubmit: SubmitHandler = async (taskFormData) => { diff --git a/src/hooks/query/useTaskQuery.ts b/src/hooks/query/useTaskQuery.ts index d28bcba4..719c3622 100644 --- a/src/hooks/query/useTaskQuery.ts +++ b/src/hooks/query/useTaskQuery.ts @@ -18,7 +18,6 @@ import type { Project } from '@/types/ProjectType'; import type { Task, TaskCreationForm, - TaskFilesForm, TaskListWithStatus, TaskOrder, TaskUpdateForm, @@ -57,11 +56,13 @@ export function useCreateStatusTask(projectId: Project['projectId']) { // 일정 단일 파일 업로드 export function useUploadTaskFile(projectId: Project['projectId']) { + const { toastError } = useToast(); const mutation = useMutation({ mutationFn: ({ taskId, file }: TaskUploadForm) => uploadTaskFile(projectId, taskId, file, { headers: { 'Content-Type': 'multipart/form-data' }, }), + onError: (error, { file }) => toastError(`${file.name} 파일 업로드에 실패 했습니다.`), }); return mutation;