Skip to content

Commit

Permalink
Merge pull request #199 from Team-Lecue/Hotfix-Dori
Browse files Browse the repository at this point in the history
[ Register ] 에러 핸들링 추가
  • Loading branch information
doyn511 authored Jan 19, 2024
2 parents 761c40e + 4bf0c53 commit 71cdb6c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const MainWrapper = styled.div`
export const IconWrapper = styled.section`
display: flex;
gap: 15.7rem;
align-items: baseline;
justify-content: space-between;
align-items: baseline;
width: 100%;
padding: 6rem 1.6rem 5rem;
Expand Down
6 changes: 4 additions & 2 deletions src/Register/components/NicknameInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ function NicknameInput(props: NicknameInputProps) {

{isValid === 'special' ? (
<S.WarnigMsg>특수문자/이모지는 사용 불가능해요</S.WarnigMsg>
) : isValid === 'duplicate' ? (
<S.WarnigMsg>이미 있는 닉네임이에요</S.WarnigMsg>
) : (
isValid === 'duplicate' && (
<S.WarnigMsg>이미 있는 닉네임이에요</S.WarnigMsg>
isValid === 'space' && (
<S.WarnigMsg>마지막 공백 제외 2자 이상 입력해주세요</S.WarnigMsg>
)
)}
</S.NicknameWrapper>
Expand Down
3 changes: 3 additions & 0 deletions src/Register/hooks/usePatchNickname.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ const usePatchNickname = (props: usePatchNicknameProps) => {
// 닉네임 중복코드 : 409
setIsValid('duplicate');
setIsActive(false);
} else if (code === 400) {
setIsValid('space');
setIsActive(false);
} else {
console.error('usePatchNickname', err.response?.data);
navigate('/error');
Expand Down
2 changes: 1 addition & 1 deletion src/Register/page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import RegisterLogo from '../components/RegisterLogo';
import SubmitButton from '../components/SubmitButton';
import * as S from './Register.style';

export type isValidState = 'valid' | 'special' | 'duplicate';
export type isValidState = 'valid' | 'special' | 'duplicate' | 'space';

function Register() {
const [isActive, setIsActive] = useState(false);
Expand Down

0 comments on commit 71cdb6c

Please sign in to comment.