From 32e92deaa370d22dc02befd55b0a427906f1e35f Mon Sep 17 00:00:00 2001 From: Seok93 Date: Tue, 24 Sep 2024 23:30:45 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20#150=20=EC=88=98=ED=96=89=EC=9E=90=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/modal/task/UpdateModalTask.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/modal/task/UpdateModalTask.tsx b/src/components/modal/task/UpdateModalTask.tsx index 9943a8e8..3941972a 100644 --- a/src/components/modal/task/UpdateModalTask.tsx +++ b/src/components/modal/task/UpdateModalTask.tsx @@ -16,7 +16,13 @@ import { TASK_VALIDATION_RULES } from '@constants/formValidationRules'; import useAxios from '@hooks/useAxios'; import useToast from '@hooks/useToast'; import { useReadStatuses } from '@hooks/query/useStatusQuery'; -import { useAddAssignee, useReadAssignees, useReadStatusTasks, useReadTaskFiles } from '@hooks/query/useTaskQuery'; +import { + useAddAssignee, + useDeleteAssignee, + useReadAssignees, + useReadStatusTasks, + useReadTaskFiles, +} from '@hooks/query/useTaskQuery'; import { useReadProjectUserRoleList } from '@hooks/query/useProjectQuery'; import { findUserByProject } from '@services/projectService'; @@ -50,6 +56,7 @@ export default function UpdateModalTask({ project, taskId, onClose: handleClose const { taskFileList, isTaskFileLoading } = useReadTaskFiles(projectId, taskId); const { mutate: addAssigneeMutate } = useAddAssignee(projectId, taskId); + const { mutate: deleteAssigneeMutate } = useDeleteAssignee(projectId, taskId); const methods = useForm({ mode: 'onChange' }); const { @@ -87,8 +94,11 @@ export default function UpdateModalTask({ project, taskId, onClose: handleClose clearData(); }; - // ToDo: 수행자 삭제 API 작업시 추가할 것 - const handleAssigneeDeleteClick = (user: SearchUser) => {}; + const handleAssigneeDeleteClick = (user: SearchUser) => { + const isIncludedUser = assigneeList.find((assignee) => assignee.userId === user.userId); + if (!isIncludedUser) return toastInfo('수행자 목록에 없는 대상입니다. 확인 후 다시 시도 해주세요.'); + deleteAssigneeMutate(user.userId); + }; // ToDo: 일정 파일 업로드 작업시 같이 작업할 것 const updateFiles = (newFiles: FileList) => {