install and handle casle & prevent page dashboard & handle register and code verfication & get data in clinics page
This commit is contained in:
@@ -6,11 +6,10 @@ 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";
|
||||
|
||||
function LogInPage({ setIsSendMsg, num, setNum, matchedCity }) {
|
||||
function LogInPage({ setIsSendMsg, num, setNum, setUuid, matchedCity }) {
|
||||
const [error, setError] = useState({ valid: true, text: "" });
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
@@ -18,39 +17,17 @@ 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 = 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))
|
||||
.sendCode(changeNumToDefault(num), "")
|
||||
.then((response) => {
|
||||
setLoading(false);
|
||||
if (response) {
|
||||
// setNum("");
|
||||
if (response.uuid) {
|
||||
setIsSendMsg(true);
|
||||
setUuid(response.uuid);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
Reference in New Issue
Block a user