Refactor: 변경된 리뷰에 따른 리팩토링
This commit is contained in:
parent
be182edd3a
commit
ba639d0c75
18
frontend/src/queries/reviews/useApproveReviewQuery.ts
Normal file
18
frontend/src/queries/reviews/useApproveReviewQuery.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { approveReview } from '@/api/reviewApi';
|
||||
|
||||
interface ReviewStatusChangeProps {
|
||||
projectId: number;
|
||||
reviewId: number;
|
||||
}
|
||||
|
||||
export default function useApproveReviewQuery({ projectId, reviewId }: ReviewStatusChangeProps) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: () => approveReview(projectId, reviewId),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['reviewDetail', reviewId] });
|
||||
},
|
||||
});
|
||||
}
|
18
frontend/src/queries/reviews/useRejectReviewQuery.ts
Normal file
18
frontend/src/queries/reviews/useRejectReviewQuery.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { rejectReview } from '@/api/reviewApi';
|
||||
|
||||
interface ReviewStatusChangeProps {
|
||||
projectId: number;
|
||||
reviewId: number;
|
||||
}
|
||||
|
||||
export default function useRejectReviewQuery({ projectId, reviewId }: ReviewStatusChangeProps) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: () => rejectReview(projectId, reviewId),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['reviewDetail', reviewId] });
|
||||
},
|
||||
});
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { updateReviewStatus } from '@/api/reviewApi';
|
||||
|
||||
export default function useUpdateReviewStatusQuery() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
projectId,
|
||||
reviewId,
|
||||
memberId,
|
||||
reviewStatus,
|
||||
}: {
|
||||
projectId: number;
|
||||
reviewId: number;
|
||||
memberId: number;
|
||||
reviewStatus: string;
|
||||
}) => updateReviewStatus(projectId, reviewId, memberId, reviewStatus),
|
||||
onSuccess: (_, variables) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['reviewDetail', variables.projectId, variables.reviewId] });
|
||||
},
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user