From 267135626ff7148946483ea70dc8335c29e73603 Mon Sep 17 00:00:00 2001 From: seungchanwoo Date: Tue, 15 Oct 2024 15:49:39 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20#210=20=ED=94=84=EB=A1=9C=EC=A0=9D?= =?UTF-8?q?=ED=8A=B8=20=EC=82=AD=EC=A0=9C=20handler=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=20=EB=B0=8F=20useEffect=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EB=B0=B0=EC=97=B4=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mocks/services/projectServiceHandler.ts | 13 +++++++------ src/pages/team/TeamPage.tsx | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mocks/services/projectServiceHandler.ts b/src/mocks/services/projectServiceHandler.ts index 1b0b380e..737fb14f 100644 --- a/src/mocks/services/projectServiceHandler.ts +++ b/src/mocks/services/projectServiceHandler.ts @@ -73,10 +73,14 @@ const projectServiceHandler = [ const accessToken = request.headers.get('Authorization'); const { projectId } = params; - if (!accessToken) return new HttpResponse(null, { status: 403 }); + if (!accessToken) return new HttpResponse(null, { status: 401 }); const projectIdToDelete = Number(projectId); + const statusIdsToDelete = STATUS_DUMMY.filter((status) => status.projectId === projectIdToDelete).map( + (status) => status.statusId, + ); + const filteredProjects = PROJECT_DUMMY.filter((project) => project.projectId !== projectIdToDelete); PROJECT_DUMMY.length = 0; PROJECT_DUMMY.push(...filteredProjects); @@ -90,9 +94,6 @@ const projectServiceHandler = [ const filteredStatuses = STATUS_DUMMY.filter((status) => status.projectId !== projectIdToDelete); STATUS_DUMMY.length = 0; STATUS_DUMMY.push(...filteredStatuses); - const statusIdsToDelete = STATUS_DUMMY.filter((status) => status.projectId === projectIdToDelete).map( - (status) => status.statusId, - ); const filteredTasks = TASK_DUMMY.filter((task) => !statusIdsToDelete.includes(task.statusId)); TASK_DUMMY.length = 0; @@ -100,14 +101,14 @@ const projectServiceHandler = [ const filteredTaskUsers = TASK_USER_DUMMY.filter((taskUser) => { const taskExists = TASK_DUMMY.some((task) => task.taskId === taskUser.taskId); - return !taskExists; + return taskExists; }); TASK_USER_DUMMY.length = 0; TASK_USER_DUMMY.push(...filteredTaskUsers); const filteredTaskFiles = TASK_FILE_DUMMY.filter((taskFile) => { const taskExists = TASK_DUMMY.some((task) => task.taskId === taskFile.taskId); - return !taskExists; + return taskExists; }); TASK_FILE_DUMMY.length = 0; TASK_FILE_DUMMY.push(...filteredTaskFiles); diff --git a/src/pages/team/TeamPage.tsx b/src/pages/team/TeamPage.tsx index 73900e59..95af9ad2 100644 --- a/src/pages/team/TeamPage.tsx +++ b/src/pages/team/TeamPage.tsx @@ -28,7 +28,7 @@ export default function TeamPage() { if (team) { setTeamName(team.teamName); } - }, [teamId, teamProjects]); + }, [teamId]); const handleOpenUpdateModal = (projectId: Project['projectId']) => { setSelectedProjectId(projectId);