Merge branch 'fe/fix/error-api' into 'fe/develop'
Fix: 멤버 추가 되게 api 재연결 See merge request s11-s-project/S11P21S002!286
This commit is contained in:
commit
67da2fcb98
@ -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);
|
||||
}
|
||||
|
||||
// 프로젝트 멤버 삭제
|
||||
|
@ -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] });
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user