Skip to content

Commit

Permalink
Merge pull request #272 from MeeTeamIdle/feature/#270_api_call_issues
Browse files Browse the repository at this point in the history
fix: 닉네임 중복 체크 시, 불필요한 api 호출 이슈 해결
  • Loading branch information
kimsuyeon0916 authored Nov 5, 2024
2 parents 942e214 + 13f4f87 commit bcd05f4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/hooks/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const useCheckDuplicateNickname = (authKeys: string[], isEnabled: boolean
queryKey: authKeys,
queryFn: isEnabled => isEnabled && checkDuplicateNickname(authKeys[1]),
enabled: isEnabled,
staleTime: 1000,
});
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/account/nicknameSetting/NicknameSettingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const NicknameSettingPage = () => {

const nickname = useDebounce(watch('nickname'));
const authKeys = ['checkDuplicateNickname', nickname];
const { data } = useCheckDuplicateNickname(authKeys, isDirty && isValid);
const { data } = useCheckDuplicateNickname(authKeys, isDirty && isValid && !!nickname);

const [duplicateNicknameValidation, setDuplicateNicknameValidation] = useState('');
const [duplicated, setDuplicated] = useState(false);
Expand Down

0 comments on commit bcd05f4

Please sign in to comment.