Skip to content
Snippets Groups Projects
Commit 04945a00 authored by 한성재's avatar 한성재 Committed by Minseo Lee
Browse files

feat: signuppage connect api

parent 989c1386
Branches
No related tags found
No related merge requests found
...@@ -21,7 +21,7 @@ interface Props { ...@@ -21,7 +21,7 @@ interface Props {
const SignupPage: React.FC<Props> = ({ connector }) => { const SignupPage: React.FC<Props> = ({ connector }) => {
const navigate = useNavigate(); const navigate = useNavigate();
const [acountData, setAcountData] = useState({ const [accountData, setAccountData] = useState({
loginId: '', loginId: '',
name: '', name: '',
password: '', password: '',
...@@ -30,8 +30,8 @@ const SignupPage: React.FC<Props> = ({ connector }) => { ...@@ -30,8 +30,8 @@ const SignupPage: React.FC<Props> = ({ connector }) => {
}); });
const [passwordAgain, setPasswordAgain] = useState<string>(''); const [passwordAgain, setPasswordAgain] = useState<string>('');
const Correct = () => { const Correct = () => {
const empty = acountData.password === ''; const empty = accountData.password === '';
const same = acountData.password === passwordAgain; const same = accountData.password === passwordAgain;
if (empty) { if (empty) {
return null; return null;
} }
...@@ -43,32 +43,34 @@ const SignupPage: React.FC<Props> = ({ connector }) => { ...@@ -43,32 +43,34 @@ const SignupPage: React.FC<Props> = ({ connector }) => {
</div> </div>
); );
}; };
const handleNameChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handleNameChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setAcountData((prev) => ({ setAccountData((prev) => ({
...prev, ...prev,
name : event.target.value name : event.target.value
})); }));
}; };
const handleIdChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handleIdChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setAcountData((prev) => ({ setAccountData((prev) => ({
...prev, ...prev,
loginId : event.target.value loginId : event.target.value
})); }));
}; };
const handleEmailChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handleEmailChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setAcountData((prev) => ({ setAccountData((prev) => ({
...prev, ...prev,
email : event.target.value email : event.target.value
})); }));
}; };
const handlePhoneChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handlePhoneChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setAcountData((prev) => ({ setAccountData((prev) => ({
...prev, ...prev,
phone : event.target.value phone : event.target.value
})); }));
}; };
const handlePasswordChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handlePasswordChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setAcountData((prev) => ({ setAccountData((prev) => ({
...prev, ...prev,
password : event.target.value password : event.target.value
})); }));
...@@ -78,24 +80,27 @@ const SignupPage: React.FC<Props> = ({ connector }) => { ...@@ -78,24 +80,27 @@ const SignupPage: React.FC<Props> = ({ connector }) => {
}; };
const handleSignup = () => { const handleSignup = () => {
if(
accountData.loginId !== '' &&
accountData.name !== '' &&
accountData.email !== '' &&
accountData.phone !== '' &&
accountData.password !== '' &&
passwordAgain !== ''
){
try {
void(async () => { void(async () => {
await connector.post('/user/register', { await fetchData('/user/register', FETCH_METHOD.POST, accountData);
loginId: 'asdf',
name: 'asdf',
password: 'asdf',
email: 'asdf@asdf.com',
phone: '010-1234-1234'
});
navigate(APP_ROUTE.LOGIN); navigate(APP_ROUTE.LOGIN);
})(); })();
// fetchData('/user/register', FETCH_METHOD.POST, setIsLogin, { } catch (e) {
// loginId: 'asdf', console.error(e);
// name: 'ms', }
// password: 'asdf', }
// email: 'asdf@asdf.com', else {
// phone: '010-1234-1234' alert('모든 정보를 입력해주세요');
// }); }
// navigate(APP_ROUTE.LOGIN);
}; };
return ( return (
...@@ -106,7 +111,7 @@ const SignupPage: React.FC<Props> = ({ connector }) => { ...@@ -106,7 +111,7 @@ const SignupPage: React.FC<Props> = ({ connector }) => {
<input placeholder={'전화번호'} onChange={handlePhoneChange}/> <input placeholder={'전화번호'} onChange={handlePhoneChange}/>
<input <input
placeholder={'비밀번호를 입력해주세요.'} placeholder={'비밀번호를 입력해주세요.'}
value={acountData.password} value={accountData.password}
onChange={handlePasswordChange} onChange={handlePasswordChange}
type={'password'} type={'password'}
/> />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment