Skip to content

Commit

Permalink
๐Ÿ“fix : ์ŠคํŽ˜์ด์Šค๋ฅผ ํƒˆํ‡ดํ•  ์‹œ ๋ฆฌ์ŠคํŠธ ์ •๋ณด๋ฅผ ๋‹ค์‹œ ๋ถˆ๋Ÿฌ์˜จ๋‹ค.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zero-1016 committed Dec 5, 2023
1 parent 60f9ccc commit c90f4c2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hooks/api/space/useSpaceUserDeleteMutation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { deleteSpaceUser } from '@/apis';
import { END_POINTS } from '@/constants';
import type { ApiResponseType } from '@/types';
import { useMutation } from '@tanstack/react-query';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import type { AxiosError } from 'axios';

type deleteSpaceType = {
Expand All @@ -9,10 +10,15 @@ type deleteSpaceType = {
};

export const useSpaceUserDeleteMutation = () => {
const queryClient = useQueryClient();
const { mutate: deleteSpaceAction } = useMutation<
ApiResponseType,
AxiosError,
deleteSpaceType
>((deleteInfo) => deleteSpaceUser(deleteInfo.spaceId, deleteInfo.spaceId));
>((deleteInfo) => deleteSpaceUser(deleteInfo.spaceId, deleteInfo.spaceId), {
onSuccess: async () => {
await queryClient.invalidateQueries([END_POINTS.SPACE_LIST]);
},
});
return { deleteSpaceAction };
};

0 comments on commit c90f4c2

Please sign in to comment.