Skip to content

Commit

Permalink
[#168] Feat: logout 시 모든 캐시 초기화 (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
ienrum authored Jul 14, 2024
1 parent fde9c8e commit 8e8fdee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/apis/logout.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMutation } from '@tanstack/react-query';
import { useMutation, useQueryClient } from '@tanstack/react-query';

import { api } from './core';

Expand All @@ -9,8 +9,11 @@ const logout = () => {
};

export const useLogoutAPI = () => {
const queryClient = useQueryClient();

const { mutateAsync } = useMutation({
mutationFn: () => logout(),
onSuccess: () => queryClient.removeQueries(),
});

return mutateAsync;
Expand Down

0 comments on commit 8e8fdee

Please sign in to comment.