From 82ed776c9d24b1f21c40b46c6d266ec5d913d16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=98=84=EC=A1=B0?= Date: Fri, 4 Oct 2024 14:26:39 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EB=A9=A4=EB=B2=84=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20=EB=90=98=EA=B2=8C=20api=20=EC=9E=AC=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/projectApi.ts | 13 +++++++------ frontend/src/pages/ProjectMemberManage.tsx | 2 +- .../useUpdateProjectMemberPrivilegeQuery.ts | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/frontend/src/api/projectApi.ts b/frontend/src/api/projectApi.ts index 526b4e5..f0eefde 100644 --- a/frontend/src/api/projectApi.ts +++ b/frontend/src/api/projectApi.ts @@ -80,13 +80,14 @@ export async function addProjectMember(projectId: number, memberId: number, newM export async function updateProjectMemberPrivilege( projectId: number, memberId: number, - privilegeData: ProjectMemberRequest + privilegeType: ProjectMemberResponse['privilegeType'] // 수정 가능한 권한 타입으로 변경 ) { - return api - .put(`/projects/${projectId}/members`, privilegeData, { - params: { memberId }, - }) - .then(({ data }) => data); + const privilegeData = { + memberId, + privilegeType, + }; + + return api.put(`/projects/${projectId}/members`, privilegeData).then(({ data }) => data); } // 프로젝트 멤버 삭제 diff --git a/frontend/src/pages/ProjectMemberManage.tsx b/frontend/src/pages/ProjectMemberManage.tsx index 2ad257d..3eac4b0 100644 --- a/frontend/src/pages/ProjectMemberManage.tsx +++ b/frontend/src/pages/ProjectMemberManage.tsx @@ -75,7 +75,7 @@ export default function ProjectMemberManage() { updatePrivilege.mutate({ projectId: Number(projectId), memberId, - privilegeData: { memberId, privilegeType: role }, + privilegeType: role, // 수정: privilegeData 대신 privilegeType만 전달 }); } else { addProjectMember.mutate({ diff --git a/frontend/src/queries/projects/useUpdateProjectMemberPrivilegeQuery.ts b/frontend/src/queries/projects/useUpdateProjectMemberPrivilegeQuery.ts index 4f60f1d..69aaf6b 100644 --- a/frontend/src/queries/projects/useUpdateProjectMemberPrivilegeQuery.ts +++ b/frontend/src/queries/projects/useUpdateProjectMemberPrivilegeQuery.ts @@ -1,6 +1,6 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import { updateProjectMemberPrivilege } from '@/api/projectApi'; -import { ProjectMemberRequest } from '@/types'; +import { ProjectMemberResponse } from '@/types'; export default function useUpdateProjectMemberPrivilegeQuery() { const queryClient = useQueryClient(); @@ -9,12 +9,12 @@ export default function useUpdateProjectMemberPrivilegeQuery() { mutationFn: ({ projectId, memberId, - privilegeData, + privilegeType, }: { projectId: number; memberId: number; - privilegeData: ProjectMemberRequest; - }) => updateProjectMemberPrivilege(projectId, memberId, privilegeData), + privilegeType: ProjectMemberResponse['privilegeType']; + }) => updateProjectMemberPrivilege(projectId, memberId, privilegeType), onSuccess: (_, variables) => { queryClient.invalidateQueries({ queryKey: ['projectMembers', variables.projectId] }); },