Merge branch 'fe/fix/error-api' into 'fe/develop'

Fix: 멤버 추가 되게 api 재연결

See merge request s11-s-project/S11P21S002!286
This commit is contained in:
김진현 2024-10-04 14:33:43 +09:00
commit 67da2fcb98
2 changed files with 11 additions and 10 deletions

View File

@ -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<ProjectMemberResponse>(`/projects/${projectId}/members`, privilegeData, {
params: { memberId },
})
.then(({ data }) => data);
const privilegeData = {
memberId,
privilegeType,
};
return api.put<ProjectMemberResponse>(`/projects/${projectId}/members`, privilegeData).then(({ data }) => data);
}
// 프로젝트 멤버 삭제

View File

@ -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] });
},