Skip to content

Commit

Permalink
feat: delete account format check (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaoNeng-wWw authored Aug 13, 2024
1 parent 06370cb commit a14c17c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
4 changes: 2 additions & 2 deletions app/(root)/authenticate/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default function LoginPage(){
<div className='space-y-5'>
<div className='space-y-5'>
<Input
label={'请输入手机号'}
placeholder={'请输入手机号'}
label={'账号'}
placeholder={'请输入手机号, 用户名或邮箱'}
isClearable
value={account}
onValueChange={setAccount}
Expand Down
31 changes: 1 addition & 30 deletions app/(root)/authenticate/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,14 @@ export default function Page(){
useEffect(()=>{
valideData()
}, [ account, policy, phone, email, pageType ]);
const checkAccountExistsByEmail = () => {
return IOC.user.checkEmail(account)
.then((exists:boolean) => exists)
.catch(() => false);
}
const checkAccountExistsByPhone = () => {
return IOC.user.checkPhone(account)
.then((exists:boolean) => exists)
.catch(() => false);
}
const onChangeAccount = (account: string) => {
setAccount(account);
setPageType("wait-check");
}

const accountCheck = () => {
setLoading(true);
if (email){
checkAccountExistsByEmail()
.then((exists) => {
setShowErr(!exists)
})
.finally(() => setLoading(false));
}
if (phone){
checkAccountExistsByPhone()
.then((exists) => {
if (!exists){
setPageType('register')
return;
}
setPageType('login')
})
.finally(()=>{
setLoading(false);
})
}
setPageType('login')
}
const onEnter = (e:KeyboardEvent) => {
if (!disabled && e.code.toLowerCase().includes('enter')){
Expand Down

0 comments on commit a14c17c

Please sign in to comment.