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
+2 -2
View File
@@ -12,7 +12,7 @@ import Detail from "@/components/booking/detail";
import FailedPay from "@/components/booking/failedPay";
import LogInPage from "@/components/register/LogInPage";
import SuccessPay from "@/components/booking/successPay";
import SetCodePage from "@/components/register/SetCodePage";
import VerificationPage from "@/components/register/verificationPage";
function BookingPage({ slug, matchedCity }) {
const doctor = doctors.find((item) => item.id === +slug);
@@ -29,7 +29,7 @@ function BookingPage({ slug, matchedCity }) {
const elements = [
<Date doctor={doctor} setStep={setStep} />,
<LogInPage setIsSendMsg={false} setStep={setStep} />,
<SetCodePage setIsSendMsg={false} link={false} setStep={setStep} />,
<VerificationPage setIsSendMsg={false} link={false} setStep={setStep} />,
<Detail
isForAnother={isForAnother}
setIsForAnother={setIsForAnother}
@@ -0,0 +1,22 @@
import PlusB from "@/components/icons/PlusB";
import { Button } from "@mui/material";
import React from "react";
function Head({ text }) {
return (
<div className="w-full flex mb-[40px] items-center justify-between">
<p className="text-[#525252] dark:text-[#A1A1A1] text-[20px] font-bold">
{text}
</p>
<Button
className="!bg-[#5559CE] !w-fit !shadow-none !rounded-[4px] !gap-[4px] !text-[#EFEFEF] !text-[14px] md:!text-[16px] !font-medium"
variant="contained"
>
<PlusB />
اضافه کردن
</Button>
</div>
);
}
export default Head;
@@ -11,7 +11,6 @@ function HeadTab({
setIsTurnsDetails,
components,
}) {
return (
<>
{isTurnsDetails ? (
@@ -50,9 +49,7 @@ function HeadTab({
handleChange={handleChange}
/>
</div>
<div className="mt-[24px] sm:mt-[28px] md:mt-[32px] px-0 md:px-[24px]">
{components[tab]}
</div>
<div className="mt-[22px] px-0 md:px-[24px]">{components[tab]}</div>
</>
)}
</>
@@ -34,6 +34,7 @@ function ContentTabs({
}) {
const [loading, setLoading] = useState(true);
const [tab, setTab] = useState(0);
const data = profileData[0];
const handleChange = (event, newValue) => {
// setValue(newValue);
@@ -57,12 +58,12 @@ function ContentTabs({
// <Comments user={user} loading={loading} />,
// <Messages user={user} loading={loading} />,
// <NotfoundDashboard />,
<Disease data={profileData} />,
<Allergies />,
<Medications />,
<Surgeries />,
<FamilyHistory />,
<Relatives />,
<Disease data={data} />,
<Allergies data={data} />,
<Medications data={data} />,
<Surgeries data={data} />,
<FamilyHistory data={data} />,
<Relatives data={data} />,
];
return (
@@ -1,7 +1,68 @@
function Allergies() {
import CustomTable from "@/app/component/CustomTable";
import TextLoading from "@/app/component/loading/Text";
import EditB from "@/components/icons/EditB";
import TrashB from "@/components/icons/TrashB";
import { Button, TableCell, TableRow } from "@mui/material";
import Head from "../../components/Head";
function Allergies({ data }) {
const tableHead = ["ردیف", "ماده آلرژی‌زا", "واکنش", "شدت", ""];
const centerTable = [0];
return (
<div>Allergies</div>
)
<div>
<Head text="لیست آلرژی ها" />
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.allergies.map((row, idx) => (
<TableRow
key={idx}
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="center"
>
<TextLoading width={15} height={18} loading={false}>
{idx + 1}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.substance}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.reaction}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.severity}
</TextLoading>
</TableCell>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="right"
>
<div className="flex items-center justify-center gap-[4px]">
<Button className="!min-w-fit !p-1" variant="text">
<TrashB />
</Button>
<Button className="!min-w-fit !p-1" variant="text">
<EditB />
</Button>
</div>
</TableCell>
</TableRow>
))}
</CustomTable>
</div>
);
}
export default Allergies
export default Allergies;
@@ -1,20 +1,23 @@
import CustomTable from "@/app/component/CustomTable";
import CircularLoading from "@/app/component/loading/Circular";
import TextLoading from "@/app/component/loading/Text";
import { TableCell, TableRow } from "@mui/material";
import EditB from "@/components/icons/EditB";
import TrashB from "@/components/icons/TrashB";
import { Button, Switch, TableCell, TableRow } from "@mui/material";
import Head from "../../components/Head";
function Disease({ data }) {
const tableHead = ["شماره", "اسم", "وضعیت"];
const centerTable = [0, 4];
const tableHead = ["ردیف", "اسم", "وضعیت", ""];
const centerTable = [0];
return (
<div className="hidden md:flex">
<div>
<Head text="لیست بیماری ها" />
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.map((row, idx) => (
{data.disease.map((row, idx) => (
<TableRow
key={idx}
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
@@ -27,21 +30,29 @@ function Disease({ data }) {
{idx + 1}
</TextLoading>
</TableCell>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="center"
>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.name}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{/* {row.status} */}
<Switch defaultChecked={row.status === "true"} />
</TextLoading>
</TableCell>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="center"
align="right"
>
<TextLoading width={15} height={18} loading={false}>
{row.status}
</TextLoading>
<div className="flex items-center justify-center gap-[4px]">
<Button className="!min-w-fit !p-1" variant="text">
<TrashB />
</Button>
<Button className="!min-w-fit !p-1" variant="text">
<EditB />
</Button>
</div>
</TableCell>
</TableRow>
))}
@@ -1,7 +1,63 @@
function FamilyHistory() {
import CustomTable from "@/app/component/CustomTable";
import TextLoading from "@/app/component/loading/Text";
import EditB from "@/components/icons/EditB";
import TrashB from "@/components/icons/TrashB";
import { Button, TableCell, TableRow } from "@mui/material";
import Head from "../../components/Head";
function FamilyHistory({ data }) {
const tableHead = ["ردیف", "بیماری", "نسبت خانوادگی", ""];
const centerTable = [0];
return (
<div>FamilyHistory</div>
)
<div>
<Head text="لیست سابقه خانوادگی بیماری" />
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.family_history.map((row, idx) => (
<TableRow
key={idx}
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="center"
>
<TextLoading width={15} height={18} loading={false}>
{idx + 1}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.disease}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.relation}
</TextLoading>
</TableCell>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="right"
>
<div className="flex items-center justify-center gap-[4px]">
<Button className="!min-w-fit !p-1" variant="text">
<TrashB />
</Button>
<Button className="!min-w-fit !p-1" variant="text">
<EditB />
</Button>
</div>
</TableCell>
</TableRow>
))}
</CustomTable>
</div>
);
}
export default FamilyHistory
export default FamilyHistory;
@@ -1,7 +1,68 @@
function Medications() {
import CustomTable from "@/app/component/CustomTable";
import TextLoading from "@/app/component/loading/Text";
import EditB from "@/components/icons/EditB";
import TrashB from "@/components/icons/TrashB";
import { Button, TableCell, TableRow } from "@mui/material";
import Head from "../../components/Head";
function Medications({ data }) {
const tableHead = ["ردیف", "نام دارو", "دوز مصرفی", "تعداد و زمان مصرف", ""];
const centerTable = [0];
return (
<div>Medications</div>
)
<div>
<Head text="لیست دارو های مصرفی" />
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.medications.map((row, idx) => (
<TableRow
key={idx}
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="center"
>
<TextLoading width={15} height={18} loading={false}>
{idx + 1}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.name}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.dose}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.frequency}
</TextLoading>
</TableCell>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="right"
>
<div className="flex items-center justify-center gap-[4px]">
<Button className="!min-w-fit !p-1" variant="text">
<TrashB />
</Button>
<Button className="!min-w-fit !p-1" variant="text">
<EditB />
</Button>
</div>
</TableCell>
</TableRow>
))}
</CustomTable>
</div>
);
}
export default Medications
export default Medications;
@@ -1,7 +1,84 @@
function Relatives() {
import CustomTable from "@/app/component/CustomTable";
import TextLoading from "@/app/component/loading/Text";
import EditB from "@/components/icons/EditB";
import TrashB from "@/components/icons/TrashB";
import { Button, TableCell, TableRow, Tooltip } from "@mui/material";
import Head from "../../components/Head";
function Relatives({ data }) {
const tableHead = ["ردیف", "نام", "نسبت", "شماره تماس", "ایمیل", "آدرس", ""];
const centerTable = [0];
return (
<div>Relatives</div>
)
<div>
<Head text="لیست بستگان" />
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.relatives.map((row, idx) => (
<TableRow
key={idx}
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="center"
>
<TextLoading width={15} height={18} loading={false}>
{idx + 1}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.name}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.relation}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{`${row.contact.phone?.replace("+", "")}+`}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.contact.email}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<Tooltip title={row.contact.address || ""} arrow>
<div className="truncate max-w-[150px] cursor-default">
<TextLoading width={15} height={18} loading={false}>
{(row.contact.address || "").substring(0, 15)}
{row.contact.address?.length > 15 ? "…" : ""}
</TextLoading>
</div>
</Tooltip>
</TableCell>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="right"
>
<div className="flex items-center justify-center gap-[4px]">
<Button className="!min-w-fit !p-1" variant="text">
<TrashB />
</Button>
<Button className="!min-w-fit !p-1" variant="text">
<EditB />
</Button>
</div>
</TableCell>
</TableRow>
))}
</CustomTable>
</div>
);
}
export default Relatives
export default Relatives;
@@ -1,7 +1,77 @@
function Surgeries() {
import CustomTable from "@/app/component/CustomTable";
import TextLoading from "@/app/component/loading/Text";
import EditB from "@/components/icons/EditB";
import TrashB from "@/components/icons/TrashB";
import { Button, TableCell, TableRow } from "@mui/material";
import Head from "../../components/Head";
function Surgeries({ data }) {
const tableHead = [
"ردیف",
"نوع جراحی",
"نام بیمارستان",
"سال انجام جراحی",
"",
];
const centerTable = [0, 3];
return (
<div>Surgeries</div>
)
<div>
<Head text="لیست جراحی ها" />
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.surgeries.map((row, idx) => (
<TableRow
key={idx}
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="center"
>
<TextLoading width={15} height={18} loading={false}>
{idx + 1}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.type}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<TextLoading width={15} height={18} loading={false}>
{row.hospital}
</TextLoading>
</TableCell>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="center"
>
<TextLoading width={15} height={18} loading={false}>
{row.year}
</TextLoading>
</TableCell>
<TableCell
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
align="right"
>
<div className="flex items-center justify-center gap-[4px]">
<Button className="!min-w-fit !p-1" variant="text">
<TrashB />
</Button>
<Button className="!min-w-fit !p-1" variant="text">
<EditB />
</Button>
</div>
</TableCell>
</TableRow>
))}
</CustomTable>
</div>
);
}
export default Surgeries
export default Surgeries;
@@ -2,7 +2,6 @@ import { useState } from "react";
import Form from "./Form";
import { styleDefault } from "@/mui";
import { Box, Button, Modal } from "@mui/material";
import { validate_phone_number } from "./validate";
// Icons
import PlusB from "@/components/icons/PlusB";
+2 -2
View File
@@ -1,7 +1,7 @@
"use client";
import RegisterPage from "@/components/register";
import SetCodePage from "@/components/register/SetCodePage";
import VerificationPage from "@/components/register/verificationPage";
import LogInPage from "@/components/register/LogInPage";
import { useState } from "react";
@@ -11,7 +11,7 @@ function ContentVerify() {
return (
<RegisterPage>
{isSendMsg ? (
<SetCodePage
<VerificationPage
setIsSendMsg={setIsSendMsg}
link={`/account/${localStorage.getItem("doctor-id")}`}
/>
+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 (
+2 -2
View File
@@ -1,6 +1,6 @@
"use client";
import SetCodePage from "@/components/register/SetCodePage";
import VerificationPage from "@/components/register/verificationPage";
import LogInPage from "@/components/register/LogInPage";
import { useState } from "react";
import LayoutRegister from "./LayoutRegister";
@@ -12,7 +12,7 @@ function RegisterPage({ matchedCity }) {
return (
<LayoutRegister matchedCity={matchedCity}>
{isSendMsg ? (
<SetCodePage
<VerificationPage
num={num}
setIsSendMsg={setIsSendMsg}
setStep={false}
@@ -0,0 +1,53 @@
import RetryLogin from "@/components/icons/RetryLogin";
import { Button } from "@mui/material";
const time_resend_code = 120;
function Recode({ retryIcon, timer, setTimer }) {
const handleTimer = () => {
setTimer("loading");
setTimeout(() => {
setTimer(time_resend_code);
let timePresent = time_resend_code;
const timerInterval = setInterval(() => {
timePresent--;
setTimer(timePresent);
!timePresent && clearInterval(timerInterval);
}, 1000);
}, 1000);
};
return (
<Button
className="flex !p-1 items-center justify-start gap-1 hover-rotate-90 cursor-pointer"
disabled={typeof timer === "number" && timer !== 0}
onClick={() => {
if (!timer && timer !== "loading") {
handleTimer();
retryIcon.current.classList.add("retry-icon");
setTimeout(() => {
retryIcon.current &&
retryIcon.current.classList.remove("retry-icon");
}, 1000);
}
}}
>
{timer && timer !== "loading" ? (
<p className="text-[#F17732] text-[14px] font-normal select-none">
{timer} ثانیه
</p>
) : (
<>
<div ref={retryIcon}>
<RetryLogin />
</div>
<p className="text-[#F17732] text-[14px] font-normal select-none">
دریافت مجدد کد
</p>
</>
)}
</Button>
);
}
export default Recode;
@@ -1,17 +1,14 @@
import { useRef, useState } from "react";
import { Button } from "@mui/material";
import OTPForm from "./element/OTPForm";
import EditLogin from "../icons/EditLogin";
import RetryLogin from "../icons/RetryLogin";
import ArrowRightS from "../icons/ArrowRightS";
import OTPForm from "../element/OTPForm";
import EditLogin from "../../icons/EditLogin";
import ArrowRightS from "../../icons/ArrowRightS";
import { request } from "@/services/response";
import { changeNumToDefault } from "@/helper";
import axios from "axios";
import Recode from "./Recode";
const time_resend_code = 120;
function SetCodePage({ setIsSendMsg, link, num, setStep }) {
function VerificationPage({ setIsSendMsg, link, num, setStep }) {
const retryIcon = useRef();
const [timer, setTimer] = useState(0);
@@ -48,58 +45,45 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) {
}
};
const handleTimer = () => {
setTimer("loading");
setTimeout(() => {
setTimer(time_resend_code);
let timePresent = time_resend_code;
const timerInterval = setInterval(() => {
timePresent--;
setTimer(timePresent);
!timePresent && clearInterval(timerInterval);
}, 1000);
}, 1000);
};
const handleReq = async () => {
const formData = new URLSearchParams();
formData.append("grant_type", "mobile");
formData.append("client_id", process.env.NEXT_PUBLIC_CLIENT_ID);
formData.append("client_secret", process.env.NEXT_PUBLIC_CLIENT_SECRET);
formData.append("mobile_number", changeNumToDefault(num));
formData.append("code", code.join(""));
// const formData = new URLSearchParams();
// formData.append("grant_type", "mobile");
// formData.append("client_id", process.env.NEXT_PUBLIC_CLIENT_ID);
// formData.append("client_secret", process.env.NEXT_PUBLIC_CLIENT_SECRET);
// formData.append("mobile_number", changeNumToDefault(num));
// formData.append("code", code.join(""));
try {
const res = await axios.post(
"https://back-dev.clinic-pro.ir/oauth/token",
formData,
{
withCredentials: true,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
}
);
console.log(res);
} catch (err) {
console.error("Request failed:", err);
}
// setLoading(true);
// request
// .getToken(
// "mobile",
// process.env.NEXT_PUBLIC_CLIENT_ID,
// process.env.NEXT_PUBLIC_CLIENT_SECRET,
// changeNumToDefault(num),
// code.join("")
// )
// .then((response) => {
// setLoading(false);
// })
// .catch((err) => {
// setLoading(false);
// });
// try {
// const res = await axios.post(
// "https://back-dev.clinic-pro.ir/oauth/token",
// formData,
// {
// withCredentials: true,
// headers: {
// "Content-Type": "application/x-www-form-urlencoded",
// },
// }
// );
// console.log(res);
// } catch (err) {
// console.error("Request failed:", err);
// }
setLoading(true);
request
.getToken(
"mobile",
process.env.NEXT_PUBLIC_CLIENT_ID,
process.env.NEXT_PUBLIC_CLIENT_SECRET,
changeNumToDefault(num),
code.join("")
)
.then((response) => {
setLoading(false);
})
.catch((err) => {
setLoading(false);
});
};
return (
@@ -120,7 +104,7 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) {
کد تایید را وارد نمایید
</p>
<p className="text-[#616161] mt-[16px] sm:mt-[19px] md:mt-[22px] lg:mt-[24px] text-[14px] font-normal text-right">
کد تایید برای شماره 09013261200 ارسال شد.
کد تایید برای شماره <span dir="ltr">09{num}</span> ارسال شد.
</p>
<div className="mt-[26px] sm:mt-[28px] md:mt-[30px] lg:mt-[32px] mb-[56px] sm:mb-[47px] md:mb-[38px] lg:mb-[30px]">
<div className="mb-[27px]" dir="ltr">
@@ -163,35 +147,7 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) {
</p>
</Button>
<Button
className="flex !p-1 items-center justify-start gap-1 hover-rotate-90 cursor-pointer"
disabled={typeof timer === "number" && timer !== 0}
onClick={() => {
if (!timer && timer !== "loading") {
handleTimer();
retryIcon.current.classList.add("retry-icon");
setTimeout(() => {
retryIcon.current &&
retryIcon.current.classList.remove("retry-icon");
}, 1000);
}
}}
>
{timer && timer !== "loading" ? (
<p className="text-[#F17732] text-[14px] font-normal select-none">
{timer} ثانیه
</p>
) : (
<>
<div ref={retryIcon}>
<RetryLogin />
</div>
<p className="text-[#F17732] text-[14px] font-normal select-none">
دریافت مجدد کد
</p>
</>
)}
</Button>
<Recode retryIcon={retryIcon} timer={timer} setTimer={setTimer} />
</div>
</div>
<Button
@@ -215,4 +171,4 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) {
);
}
export default SetCodePage;
export default VerificationPage;
+11 -11
View File
@@ -9,7 +9,7 @@
{
"id": 2,
"name": "دیابت",
"status": "false"
"status": "true"
},
{
"id": 3,
@@ -19,17 +19,17 @@
{
"id": 4,
"name": "بیماری قلبی عروقی",
"status": "false"
"status": "true"
},
{
"id": 5,
"name": "سرطان",
"status": "false"
"status": "true"
},
{
"id": 6,
"name": "آلزایمر",
"status": "false"
"status": "true"
},
{
"id": 7,
@@ -39,7 +39,7 @@
{
"id": 8,
"name": "بیماری کلیوی",
"status": "false"
"status": "true"
},
{
"id": 9,
@@ -59,7 +59,7 @@
{
"id": 12,
"name": "اضطراب مزمن",
"status": "false"
"status": "true"
},
{
"id": 13,
@@ -74,7 +74,7 @@
{
"id": 15,
"name": "پرکاری تیروئید",
"status": "false"
"status": "true"
},
{
"id": 16,
@@ -89,7 +89,7 @@
{
"id": 18,
"name": "هپاتیت C",
"status": "false"
"status": "true"
},
{
"id": 19,
@@ -99,17 +99,17 @@
{
"id": 20,
"name": "COVID-19",
"status": "false"
"status": "true"
},
{
"id": 21,
"name": "لوپوس",
"status": "false"
"status": "true"
},
{
"id": 22,
"name": "ام‌اس (MS)",
"status": "false"
"status": "true"
},
{
"id": 23,
+2
View File
@@ -10,6 +10,8 @@ const api = axios.create({
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${cookies.get("access")}`,
Cookie:
"SESS318c6addec00b99e23988eb0e987826b=HpiIBmiGFlESY-f3IhkXEE5sq0mKVT-loNm5TiTN-UstIzn1",
},
});
+2
View File
@@ -25,6 +25,8 @@ export const request = {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "",
withCredentials: true,
Cookie:
"SESS318c6addec00b99e23988eb0e987826b=HpiIBmiGFlESY-f3IhkXEE5sq0mKVT-loNm5TiTN-UstIzn1",
},
});
},