handle api register & change design dashboard tabs and page disease

This commit is contained in:
Ehsan
2025-05-23 00:04:13 +03:30
parent c469f2ee3c
commit 6b1983fb0b
41 changed files with 527 additions and 157 deletions
+13 -2
View File
@@ -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);