handle api register & change design dashboard tabs and page disease
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import Field from "@/app/component/element/Field";
|
||||
import { changeNumToDefault, formatPhoneNumber, validatePhoneNumber } from "@/helper";
|
||||
import {
|
||||
changeNumToDefault,
|
||||
formatPhoneNumber,
|
||||
validatePhoneNumber,
|
||||
} from "@/helper";
|
||||
import { request } from "@/services/response";
|
||||
import { InputAdornment, Button } from "@mui/material";
|
||||
import Link from "next/link";
|
||||
@@ -13,7 +17,11 @@ function LogInPage({ setIsSendMsg, num, setNum, matchedCity }) {
|
||||
const formatted = formatPhoneNumber(val);
|
||||
const checkedNum = validatePhoneNumber(formatted);
|
||||
setError(checkedNum);
|
||||
const digits = formatted.replace(/\D/g, "");
|
||||
setNum(formatted);
|
||||
if (digits.length === 9) {
|
||||
handleReq();
|
||||
}
|
||||
};
|
||||
const handleReq = () => {
|
||||
setLoading(true);
|
||||
@@ -21,7 +29,10 @@ function LogInPage({ setIsSendMsg, num, setNum, matchedCity }) {
|
||||
.sendCode(changeNumToDefault(num))
|
||||
.then((response) => {
|
||||
setLoading(false);
|
||||
if (response) setIsSendMsg(true);
|
||||
if (response) {
|
||||
setNum("");
|
||||
setIsSendMsg(true);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
setLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user