Skip to content

Commit

Permalink
다계정 대응
Browse files Browse the repository at this point in the history
  • Loading branch information
chaeseungyun committed Sep 20, 2024
1 parent ff3a92e commit cd0c242
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/query/auth.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 {
loginByPhone, postLogout, findPasswordVerify, findPassword, newPassword,
} from 'api/auth';
Expand All @@ -10,6 +10,7 @@ import { useErrorMessageStore } from 'store/errorMessageStore';
import useUserTypeStore from 'store/useUserTypeStore';
import useUserStore from 'store/user';
import { isKoinError, sendClientError } from '@bcsdlab/koin';
import { shopKeys } from './KeyFactory/shopKeys';

interface VerifyInput {
email: string;
Expand Down Expand Up @@ -86,6 +87,7 @@ export const useLogout = () => {
const { updateUserType } = useUserTypeStore();
const { removeUser } = useUserStore();
const { setLogoutError, setLogoutErrorCode } = useErrorMessageStore();
const queryClient = useQueryClient();

const { mutate, error, isError } = useMutation({
mutationFn: async () => {
Expand All @@ -101,6 +103,7 @@ export const useLogout = () => {
localStorage.removeItem('refresh_token');
removeUser();
updateUserType();
queryClient.invalidateQueries({ queryKey: shopKeys.all });
},
onError: (err) => {
if (isKoinError(err)) {
Expand Down

0 comments on commit cd0c242

Please sign in to comment.