Skip to content

Commit

Permalink
feat: change signup page
Browse files Browse the repository at this point in the history
remove slackId form and check nickname
  • Loading branch information
seo-wo committed Dec 20, 2023
1 parent 7254b4e commit 8de94b5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/Auth/AuthSignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,30 @@ const AuthSignUp = () => {

const handleSubmit = (e: any) => {
e.preventDefault();
const nickname = e.target[0].value;
const nicknameRegex = /^[a-zA-Z0-9-]+$/;
if (!nicknameRegex.test(nickname)) {
setNicknameError(true);
return;
}
if (!e.target[0].value) {
setNicknameError(true);
return;
}
apiClient
.post('/auth/signup', {
nickname: e.target[0].value,
slackId: e.target[1].value,
slackId: '',
imageUrl: profileImage,
})
.then((res) => {
saveToken(res.data.access_token);
setLoginState(() => {
return {
id: res.data.id,
id: e.target[0].value,
isLogin: true,
isAdmin: false,
profileUrl: res.data.url,
profileUrl: profileImage,
};
});
navigate('/');
Expand All @@ -61,9 +67,7 @@ const AuthSignUp = () => {
{openProfileModal && <ProfileModal />}
<form className={`authForm`} onSubmit={handleSubmit}>
<input type="text" placeholder="닉네임을 입력해주세요" maxLength={10} className={`authForm--input`} />
{nicknameError && <p className={`authForm--error_message`}>닉네임을 입력해주세요.</p>}
<br />
<input type="text" placeholder="slack id" maxLength={20} className={`authForm--input`} />
{nicknameError && <p className={`authForm--error_message`}>닉네임은 영어대소문자, 숫자 그리고 '-'만 허용합니다.</p>}
<br />
<button className={`authForm--button`}>Sign Up</button>
</form>
Expand Down

0 comments on commit 8de94b5

Please sign in to comment.