Skip to content

Commit

Permalink
fix: 닉네임 중복 체크 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
a-honey committed Feb 22, 2024
1 parent 2fdddfe commit 7a4f77e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/pages/mypage/profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,16 @@ const FriendsListPage: NextPage = () => {
isDuplicated: boolean;
};
}>(`/users/nickname/check?nickname=${nickName}`);
return res?.data?.data.isDuplicated;
setIsNicknameChecked(true);
setIsNicknameAvailable(!res?.data?.data.isDuplicated);
} catch (error) {
console.error('Error checking nickname:', error);
return null;
}
};

const debouncedHandleNicknameChange = useCallback(
debounceFunction((currentNickname: string) => {
const result = nickNameCheckResult(currentNickname);
setIsNicknameChecked(true);
setIsNicknameAvailable(result);
void nickNameCheckResult(currentNickname);
}, 1000),
[],
);
Expand Down

0 comments on commit 7a4f77e

Please sign in to comment.