Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature-058: 카카오 아이콘 추가 및 닉네임 중복 현상 추가 #66

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/assets/kakao-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 24 additions & 5 deletions src/components/ProfilePage/Account/Account.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { AxiosError } from 'axios';
import { useEffect, useMemo, useRef, useState } from 'react';
import { useRecoilState } from 'recoil';

import { getMyInfoAPI, updateMyInfoAPI } from '@/apis/user';

import NaverIconImage from '@/assets/naver-icon.png';
import KakaoIconImage from '@/assets/kakao-icon.png';

import { Tooltip } from '@/components/common';

import { GENDER_TYPE_LIST } from '@/constants/user';

import useFocus from '@/hooks/useFocus';

import { APIBaseResponse } from '@/models/config/axios';

import { userInfoState } from '@/stores/user';

import theme from '@/styles/theme';
Expand Down Expand Up @@ -46,7 +50,7 @@ const Account = () => {

const nicknameInputStyle = {
border: `1.5px solid ${
isErrorNickname
isErrorNickname || isDuplicateNickname
? theme.color.red
: isNicknameFocus
? theme.color.gray500
Expand Down Expand Up @@ -98,8 +102,14 @@ const Account = () => {
showTooltip();
refreshMyInfo();
}
} catch (e) {
console.error(e);
} catch (error) {
if (error instanceof AxiosError) {
const { code } = error.response?.data as APIBaseResponse;

if (code === 'DUPLICATE_NICKNAME') {
setIsDuplicateNickname(true);
}
}
}
};

Expand Down Expand Up @@ -227,7 +237,9 @@ const Account = () => {
<div className="account-group">
<span className="group-title">전화번호</span>

<div className="input-box disabled">{userInfo?.phone_number}</div>
<div className="input-box disabled">
{userInfo?.phone_number || '-'}
</div>
</div>

{isSocialAccount && (
Expand All @@ -238,7 +250,14 @@ const Account = () => {
className="input-box disabled"
style={{ display: 'flex', alignItems: 'center', gap: 10 }}
>
<img src={NaverIconImage} width={40} />
<img
src={
userInfo.platform === 'kakao'
? KakaoIconImage
: NaverIconImage
}
width={40}
/>

<span>{userInfo?.email}</span>
</div>
Expand Down
Loading