last update
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
} from "@/helper";
|
||||
import { request } from "@/services/response";
|
||||
import { InputAdornment, Button } from "@mui/material";
|
||||
import axios from "axios";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
|
||||
@@ -23,20 +24,39 @@ function LogInPage({ setIsSendMsg, num, setNum, matchedCity }) {
|
||||
// handleReq();
|
||||
// }
|
||||
};
|
||||
const handleReq = () => {
|
||||
setLoading(true);
|
||||
request
|
||||
.sendCode(changeNumToDefault(num))
|
||||
.then((response) => {
|
||||
setLoading(false);
|
||||
if (response) {
|
||||
// setNum("");
|
||||
setIsSendMsg(true);
|
||||
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",
|
||||
},
|
||||
}
|
||||
})
|
||||
.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 (
|
||||
|
||||
Reference in New Issue
Block a user