diff --git a/src/pages/SignInPage.tsx b/src/pages/SignInPage.tsx index 6c2850a..28e1577 100644 --- a/src/pages/SignInPage.tsx +++ b/src/pages/SignInPage.tsx @@ -1,4 +1,4 @@ -import { Button, PasswordInput, TextInput } from '@mantine/core'; +import { Button, Container, PasswordInput, TextInput } from '@mantine/core'; import { useState } from 'react'; import useUser from '../hooks/useUser'; import { Circles } from 'react-loader-spinner'; @@ -28,7 +28,7 @@ function SignInPage() { ) : ( - <> +

Sign In

{error &&

{error}

} setLoginId(event.currentTarget.value)} required + style={{ marginBottom: 5 }} /> setPassword(event.currentTarget.value)} required /> - - + +
)} ); diff --git a/src/pages/SignUpPage.tsx b/src/pages/SignUpPage.tsx index cb3c3fc..948fccb 100644 --- a/src/pages/SignUpPage.tsx +++ b/src/pages/SignUpPage.tsx @@ -1,16 +1,26 @@ -import { Button, PasswordInput, TextInput } from '@mantine/core'; +import { Button, Container, PasswordInput, TextInput } from '@mantine/core'; import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { register } from '../api/auth'; +import Swal from 'sweetalert2'; function SignUpPage() { const [name, setName] = useState(''); const [registerId, setRegisterId] = useState(''); const [password, setPassword] = useState(''); + const [passwordConfirm, setPasswordConfirm] = useState(''); const [error, setError] = useState(''); const navigate = useNavigate(); const handleSignUp = async () => { + if (password !== passwordConfirm) { + Swal.fire({ + title: 'Password not match', + text: 'please enter again', + icon: 'error', + }); + return; + } try { const response = await register({ name, registerId, password }); if (response.message) { @@ -20,13 +30,13 @@ function SignUpPage() { } } catch (err: any) { setError( - 'Sign up failed: ' + (err.response?.data?.message || err.message), + 'Sign up failed: ' + (err.response?.data?.message || err.message) ); } }; return ( - <> +

Sign Up

{error &&

{error}

} setName(event.currentTarget.value)} required + style={{ marginBottom: 5 }} /> setRegisterId(event.currentTarget.value)} required + style={{ marginBottom: 5 }} /> setPassword(event.currentTarget.value)} required + style={{ marginBottom: 5 }} + placeholder="(6자리 이상)" + /> + setPasswordConfirm(event.currentTarget.value)} + required + style={{ marginBottom: 5 }} + placeholder="(6자리 이상)" /> - - + +
); }