handle all pages dashboard & register api

This commit is contained in:
Ehsan
2025-05-24 22:17:55 +03:30
parent 7dfad1847a
commit 5fa740ad1b
19 changed files with 549 additions and 182 deletions
+30 -31
View File
@@ -25,38 +25,37 @@ function LogInPage({ setIsSendMsg, num, setNum, matchedCity }) {
// }
};
const handleReq = async () => {
try {
const res = await axios.post(
"https://back-dev.clinic-pro.ir/api/v1/user/auth?_format=json",
{ mobile_number: changeNumToDefault(num) },
{
withCredentials: true,
headers: {
"Content-Type": "application/json",
},
}
);
console.log(res);
if (res.data) {
setIsSendMsg(true);
}
} catch (err) {
console.error("Request failed:", err);
}
// setLoading(true);
// request
// .sendCode(changeNumToDefault(num))
// .then((response) => {
// setLoading(false);
// if (response) {
// // setNum("");
// setIsSendMsg(true);
// try {
// const res = await axios.post(
// "https://back-dev.clinic-pro.ir/api/v1/user/auth?_format=json",
// { mobile_number: changeNumToDefault(num) },
// {
// withCredentials: true,
// headers: {
// "Content-Type": "application/json",
// },
// }
// })
// .catch(() => {
// setLoading(false);
// });
// );
// console.log(res);
// if (res.data) {
// setIsSendMsg(true);
// }
// } catch (err) {
// console.error("Request failed:", err);
// }
setLoading(true);
request
.sendCode(changeNumToDefault(num))
.then((response) => {
setLoading(false);
if (response) {
// setNum("");
setIsSendMsg(true);
}
})
.catch(() => {
setLoading(false);
});
};
return (