Skip to content

Commit

Permalink
[FEAT] 회원가입 완료시에 로그인 페이지로 이동 #57
Browse files Browse the repository at this point in the history
  • Loading branch information
yoouyeon committed Aug 11, 2023
1 parent dc2f1b1 commit dc2f28e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pages/SignUp.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useTheme } from '@emotion/react';
import { useNavigate } from 'react-router-dom';
import EmailCheck from '../components/SignUp/EmailCheck';
import PasswordCheck from '../components/SignUp/PasswordCheck';
import NicknameCheck from '../components/SignUp/NicknameCheck';
Expand All @@ -25,6 +26,7 @@ const signupResultMessage: Record<SignupStatusType, string> = {

function SignUp() {
const theme = useTheme();
const navigate = useNavigate();
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const formData = new FormData(e.currentTarget);
Expand Down Expand Up @@ -52,6 +54,7 @@ function SignUp() {
signup(requestForm)
.then((res: SignupStatusType) => {
alert(signupResultMessage[res]);
if (res === 'USER_CREATED') navigate('/sign-in');
})
.catch(() => {
alert(signupResultMessage['INTERNAL_SERVER_ERROR']);
Expand Down

0 comments on commit dc2f28e

Please sign in to comment.