Skip to content

Commit

Permalink
#97 FIX: mutateAsync 활용
Browse files Browse the repository at this point in the history
  • Loading branch information
iOdiO89 committed Jul 12, 2024
1 parent e917a5b commit a588b0a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/hooks/query/relation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ function useGetRelationList() {
}

function usePostRelation() {
const { mutate, isSuccess } = useMutation({
const { mutateAsync } = useMutation({
mutationKey: ["postRelationMutate"],
mutationFn: ({ storeId, memberId, body }: UsePostRelationProps) =>
mutationFn: async ({ storeId, memberId, body }: UsePostRelationProps) =>
postRelation(storeId, memberId, body),
});
return { mutate, isSuccess };
return { mutateAsync };
}

function usePostRelationAdmin() {
Expand All @@ -69,6 +69,7 @@ function usePostRelationAdmin() {
}

function useStaffJoin() {
const { mutateAsync: postRelationMutate } = usePostRelation();
const { mutate: postPlanListMutate } = usePostPlanList();
const queryClient = useQueryClient();
const router = useRouter();
Expand All @@ -81,7 +82,7 @@ function useStaffJoin() {
body,
inviteSchedule,
}: UsePostRelationProps & { inviteSchedule: InviteSchedule }) => {
await postRelation(storeId, memberId, body);
await postRelationMutate({ storeId, memberId, body });
postPlanListMutate({ storeId, memberId, inviteSchedule });
},
onSuccess: async () => {
Expand Down

0 comments on commit a588b0a

Please sign in to comment.