Skip to content

Commit 7f7a41b

Browse files
authored
Merge pull request #188 from prgrms-fe-devcourse/refactor/SignupModal
refactor: SignupModal description 분리
2 parents ef79502 + 4a3d5f9 commit 7f7a41b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/pages/SignupPage/index.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const StyledText = styled(Text)`
2020
`;
2121

2222
const SignupPage = () => {
23+
const [description, setDescription] = useState('');
2324
const [showModal, setShowModal] = useState(false);
2425
const [showLoginModal, setShowLoginModal] = useState(false);
2526
const navigate = useNavigate();
@@ -47,6 +48,11 @@ const SignupPage = () => {
4748
setShowLoginModal(true);
4849
} catch (e) {
4950
e.message = 'SignupError';
51+
if (e.code === 'ERR_BAD_REQUEST') {
52+
setDescription('이미 가입된 이메일입니다.');
53+
} else if (e.code === 'ERR_NETWORK') {
54+
setDescription('네트워크 연결이 불안정합니다.');
55+
}
5056
setShowModal(true);
5157
throw e;
5258
}
@@ -67,7 +73,7 @@ const SignupPage = () => {
6773
<Modal visible={showModal} onClose={closeModal}>
6874
<Modal.Content
6975
title="회원가입에 실패했어요!"
70-
description="이메일 및 비밀번호를 다시 확인해 주세요."
76+
description={description ? description : '이메일 및 비밀번호를 다시 확인해 주세요.'}
7177
onClose={closeModal}
7278
></Modal.Content>
7379
<Modal.Button onClick={closeModal}>확인</Modal.Button>

0 commit comments

Comments
 (0)