Skip to content

Commit

Permalink
feat: modify call my api when signup on success
Browse files Browse the repository at this point in the history
  • Loading branch information
timepresent95 committed Oct 11, 2024
1 parent 82909f0 commit 5645a82
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/store/queries/useAuthQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import { getUniqueId } from 'react-native-device-info';

import useCredentialStore from '../stores/credentialStore';

import { userQueryKeys } from './user';

import {
postSignIn,
postSignUp,
validateInviteCode,
validateNickName,
} from '@/api/auth';
import queryClient from '@/api/queryClient';
import { authRouteNames } from '@/constants';
import useSignupStore from '@/store/stores/signupStore';
import type { AuthToken } from '@/types';
Expand Down Expand Up @@ -119,8 +122,12 @@ export function useSignUp() {
},
});
},
onSuccess: ({ accessToken, refreshToken }) =>
setToken({ accessToken, refreshToken }),
onSuccess: ({ accessToken, refreshToken }) => {
setToken({ accessToken, refreshToken });
queryClient.invalidateQueries({
queryKey: userQueryKeys.my(),
});
},
onError: error => {
if (error instanceof TypeError) {
//NOTE: 잘못된 로직 설계로 인해 발생되는 에러
Expand Down

0 comments on commit 5645a82

Please sign in to comment.