From d95815d4aae63297b71130051d249fdaea951da6 Mon Sep 17 00:00:00 2001 From: Ehsan Date: Tue, 27 May 2025 03:40:06 +0330 Subject: [PATCH] install and handle casle & prevent page dashboard & handle register and code verfication & get data in clinics page --- app/clinics/page.js | 19 ++++- app/dashboard/page.js | 11 ++- components/clinics/index.js | 14 +--- components/clinics/list/ItemClinic.js | 30 +++---- components/clinics/list/index.js | 4 +- .../userAccount/components/AddBtn.js | 17 ++++ .../dashboard/userAccount/components/Head.js | 12 +-- .../dashboard/userAccount/content/index.js | 13 +-- .../userAccount/tabs/allergies/index.js | 5 +- .../userAccount/tabs/disease/index.js | 31 ++++--- .../userAccount/tabs/familyHistory/index.js | 5 +- .../userAccount/tabs/medications/index.js | 5 +- .../userAccount/tabs/relatives/index.js | 21 ++--- .../userAccount/tabs/surgeries/index.js | 5 +- components/doctors/modal/Content.js | 2 - components/icons/UpdateList.js | 34 ++++++++ components/register/LogInPage.js | 31 +------ components/register/index.js | 11 ++- .../register/verificationPage/SendReq.js | 83 ++++++++++++++++++ components/register/verificationPage/index.js | 84 ++++--------------- data/profile_other.json | 2 - lib/ability.js | 16 ++++ lib/auth.js | 8 ++ package-lock.json | 59 +++++++++++++ package.json | 2 + services/api.js | 3 - services/response.js | 15 ++-- 27 files changed, 336 insertions(+), 206 deletions(-) create mode 100644 components/dashboard/userAccount/components/AddBtn.js create mode 100644 components/icons/UpdateList.js create mode 100644 components/register/verificationPage/SendReq.js create mode 100644 lib/ability.js create mode 100644 lib/auth.js diff --git a/app/clinics/page.js b/app/clinics/page.js index 588d600..4074d50 100644 --- a/app/clinics/page.js +++ b/app/clinics/page.js @@ -1,15 +1,26 @@ +// app/clinics/page.js import ClinicsPage from "@/components/clinics"; import Layout from "@/components/layout/StLayout"; import { getStateInfo } from "@/lib/getStateInfo"; +import axios from "axios"; -function Clinics() { +export default async function Clinics() { const { matchedCity, matchedState } = getStateInfo(); + const response = await axios.get( + "https://back-dev.clinic-pro.ir/api/v1/clinics?page=1&limit=10" + ); + + const clinics = response.data.$data; + console.log(clinics); + return ( - + ); } - -export default Clinics; diff --git a/app/dashboard/page.js b/app/dashboard/page.js index fe89cd2..bf90a72 100644 --- a/app/dashboard/page.js +++ b/app/dashboard/page.js @@ -1,8 +1,17 @@ import Content from "@/components/dashboard/Content"; +import { defineAbilitiesFor } from "@/lib/ability"; +import { getUser } from "@/lib/auth"; import { getStateInfo } from "@/lib/getStateInfo"; +import { redirect } from "next/navigation"; -function UserAccount() { +async function UserAccount() { const { matchedCity } = getStateInfo(); + const user = await getUser(); + const ability = defineAbilitiesFor(user); + + if (!ability.can("access", "Dashboard")) { + return redirect("/"); + } return ; } diff --git a/components/clinics/index.js b/components/clinics/index.js index 498c7a9..7d0faa5 100644 --- a/components/clinics/index.js +++ b/components/clinics/index.js @@ -1,15 +1,13 @@ "use client"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import List from "./list"; import { searchOnList } from "@/helper"; import SearchBar from "./head/SearchBar"; -import clinics from "@/data/clinics.json"; import HeadPageList from "@/app/component/head"; -function ClinicsPage({ matchedCity, matchedState }) { - const [loading, setLoading] = useState(true); +function ClinicsPage({ clinics, matchedCity, matchedState }) { const [filteredClinics, setFilteredClinics] = useState(clinics); const [selected, setSelected] = useState({ @@ -17,12 +15,6 @@ function ClinicsPage({ matchedCity, matchedState }) { city: matchedCity?.name || "", }); - useEffect(() => { - setTimeout(() => { - setLoading(false); - }, 2000); - }, []); - const handleSearch = (value) => { const searchOnName = searchOnList(clinics, value, "title"); const searchOnLocation = searchOnList(searchOnName, selected.city, "city"); @@ -42,7 +34,7 @@ function ClinicsPage({ matchedCity, matchedState }) { handleSearch={handleSearch} /> - + ); } diff --git a/components/clinics/list/ItemClinic.js b/components/clinics/list/ItemClinic.js index 410875d..0145857 100644 --- a/components/clinics/list/ItemClinic.js +++ b/components/clinics/list/ItemClinic.js @@ -7,20 +7,25 @@ import { Button } from "@mui/material"; import Image from "next/image"; import Link from "next/link"; -function ItemClinic({ data, loading }) { +function ItemClinic({ data }) { return (
  • - - img clinic + + img clinic
    - +

    - {data.title} + {data.label}

    - +

    {data.doctors} پزشک

    @@ -30,7 +35,7 @@ function ItemClinic({ data, loading }) {
    - +

    {data.location}

    @@ -38,7 +43,7 @@ function ItemClinic({ data, loading }) {
    - +

    ساعت کاری: {data.hours_of_work}

    @@ -47,13 +52,8 @@ function ItemClinic({ data, loading }) {
    {/* Arrow */} - - diff --git a/components/clinics/list/index.js b/components/clinics/list/index.js index ac30067..c61e109 100644 --- a/components/clinics/list/index.js +++ b/components/clinics/list/index.js @@ -2,7 +2,7 @@ import Pageguide from "@/app/component/Pageguide"; import ItemClinic from "./ItemClinic"; import Pagination from "@/app/component/Pagination"; -function List({ loading, selected, clinics }) { +function List({ selected, clinics }) { const listPage = ["کلینیک ها", selected?.city || ""]; return ( @@ -18,7 +18,7 @@ function List({ loading, selected, clinics }) { gap-y-[16px] sm:gap-y-[24px] md:gap-y-[32px] lg:gap-y-[40px] mt-6" > {clinics.map((item) => ( - + ))} )} diff --git a/components/dashboard/userAccount/components/AddBtn.js b/components/dashboard/userAccount/components/AddBtn.js new file mode 100644 index 0000000..0208d72 --- /dev/null +++ b/components/dashboard/userAccount/components/AddBtn.js @@ -0,0 +1,17 @@ +import PlusB from "@/components/icons/PlusB"; +import { Button } from "@mui/material"; +import React from "react"; + +function AddBtn() { + return ( + + ); +} + +export default AddBtn; diff --git a/components/dashboard/userAccount/components/Head.js b/components/dashboard/userAccount/components/Head.js index afd8d4c..f3889da 100644 --- a/components/dashboard/userAccount/components/Head.js +++ b/components/dashboard/userAccount/components/Head.js @@ -1,20 +1,12 @@ -import PlusB from "@/components/icons/PlusB"; -import { Button } from "@mui/material"; import React from "react"; -function Head({ text }) { +function Head({ text, children }) { return (

    {text}

    - + {children}
    ); } diff --git a/components/dashboard/userAccount/content/index.js b/components/dashboard/userAccount/content/index.js index 65675fe..9fc6edf 100644 --- a/components/dashboard/userAccount/content/index.js +++ b/components/dashboard/userAccount/content/index.js @@ -36,8 +36,7 @@ function ContentTabs({ const [tab, setTab] = useState(0); const data = profileData[0]; - const handleChange = (event, newValue) => { - // setValue(newValue); + const handleChange = (_, newValue) => { setTab(newValue); }; @@ -48,16 +47,6 @@ function ContentTabs({ }, []); const components = [ - // , - // , - // , - // , - // , - // , , , , diff --git a/components/dashboard/userAccount/tabs/allergies/index.js b/components/dashboard/userAccount/tabs/allergies/index.js index 83ce10d..1851dc9 100644 --- a/components/dashboard/userAccount/tabs/allergies/index.js +++ b/components/dashboard/userAccount/tabs/allergies/index.js @@ -4,6 +4,7 @@ import EditB from "@/components/icons/EditB"; import TrashB from "@/components/icons/TrashB"; import { Button, TableCell, TableRow } from "@mui/material"; import Head from "../../components/Head"; +import AddBtn from "../../components/AddBtn"; function Allergies({ data }) { const tableHead = ["ردیف", "ماده آلرژی‌زا", "واکنش", "شدت", ""]; @@ -11,7 +12,9 @@ function Allergies({ data }) { return (
    - + + + - + +
    + + +
    + - {/* {row.status} */} - -
    - - -
    -
    ))}
    diff --git a/components/dashboard/userAccount/tabs/familyHistory/index.js b/components/dashboard/userAccount/tabs/familyHistory/index.js index 1ea29ed..40793e4 100644 --- a/components/dashboard/userAccount/tabs/familyHistory/index.js +++ b/components/dashboard/userAccount/tabs/familyHistory/index.js @@ -4,6 +4,7 @@ import EditB from "@/components/icons/EditB"; import TrashB from "@/components/icons/TrashB"; import { Button, TableCell, TableRow } from "@mui/material"; import Head from "../../components/Head"; +import AddBtn from "../../components/AddBtn"; function FamilyHistory({ data }) { const tableHead = ["ردیف", "بیماری", "نسبت خانوادگی", ""]; @@ -11,7 +12,9 @@ function FamilyHistory({ data }) { return (
    - + + + - + + + - + + + - - {row.contact.email} - - - - -
    - - {(row.contact.address || "").substring(0, 15)} - {row.contact.address?.length > 15 ? "…" : ""} - -
    -
    + {row.contact.address}
    - + + + { const current = new URLSearchParams(window.location.search); diff --git a/components/icons/UpdateList.js b/components/icons/UpdateList.js new file mode 100644 index 0000000..2f4e9d9 --- /dev/null +++ b/components/icons/UpdateList.js @@ -0,0 +1,34 @@ +function UpdateList() { + return ( + + + + + + ); +} + +export default UpdateList; diff --git a/components/register/LogInPage.js b/components/register/LogInPage.js index c52e775..1b7fc7d 100644 --- a/components/register/LogInPage.js +++ b/components/register/LogInPage.js @@ -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(() => { diff --git a/components/register/index.js b/components/register/index.js index 3c58af3..90ecc46 100644 --- a/components/register/index.js +++ b/components/register/index.js @@ -7,23 +7,26 @@ import LayoutRegister from "./LayoutRegister"; function RegisterPage({ matchedCity }) { const [isSendMsg, setIsSendMsg] = useState(false); + const [uuid, setUuid] = useState(""); const [num, setNum] = useState(""); return ( {isSendMsg ? ( ) : ( )} diff --git a/components/register/verificationPage/SendReq.js b/components/register/verificationPage/SendReq.js new file mode 100644 index 0000000..a9dd7fe --- /dev/null +++ b/components/register/verificationPage/SendReq.js @@ -0,0 +1,83 @@ +import { Button } from "@mui/material"; +import { useRouter } from "next/navigation"; +import { request } from "@/services/response"; +import Cookies from "js-cookie"; + +function SendReq({ + loading, + setLoading, + code, + setIsSendMsg, + setStep, + setIsError, + uuid, +}) { + const router = useRouter(); + + const handleSetCookie = (response) => { + const accessTokenExpires = new Date(); + accessTokenExpires.setSeconds( + accessTokenExpires.getSeconds() + response.expires_in + ); + const refreshTokenExpires = new Date(); + refreshTokenExpires.setDate(refreshTokenExpires.getDate() + 30); + + Cookies.set("access_token", response.access_token, { + expires: accessTokenExpires, + path: "/", + secure: true, + sameSite: "strict", + }); + + Cookies.set("refresh_token", response.refresh_token, { + expires: refreshTokenExpires, + path: "/", + secure: true, + sameSite: "strict", + }); + }; + + const handleReq = async () => { + setLoading(true); + request + .getToken( + "mobile", + process.env.NEXT_PUBLIC_CLIENT_ID, + process.env.NEXT_PUBLIC_CLIENT_SECRET, + uuid, + code.join("") + ) + .then((response) => { + setLoading(false); + if (response.access_token) { + router.replace("/"); + handleSetCookie(response); + } + }) + .catch(() => { + setLoading(false); + }); + }; + + return ( + + ); +} + +export default SendReq; diff --git a/components/register/verificationPage/index.js b/components/register/verificationPage/index.js index 0b78b89..cdb4ef3 100644 --- a/components/register/verificationPage/index.js +++ b/components/register/verificationPage/index.js @@ -1,25 +1,25 @@ +"use client"; + import { useRef, useState } from "react"; import { Button } from "@mui/material"; 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 Recode from "./Recode"; +import SendReq from "./SendReq"; -function VerificationPage({ setIsSendMsg, link, num, setStep }) { +function VerificationPage({ setIsSendMsg, uuid, link, num, setStep }) { const retryIcon = useRef(); const [timer, setTimer] = useState(0); const [loading, setLoading] = useState(false); - const [code, setCode] = useState(["", "", "", ""]); + const [code, setCode] = useState(["", "", "", "", ""]); const [isError, setIsError] = useState(false); const inputRefs = Array.from({ length: 5 }, () => useRef()); const handleChange = (index, val) => { const newCode = [...code]; - if (val === "backspace") { newCode[index] = ""; setCode(newCode); @@ -28,64 +28,16 @@ function VerificationPage({ setIsSendMsg, link, num, setStep }) { } return; } - newCode[index] = val; - - if (newCode.join("").length === 4 && isError) { + if (newCode.join("").length === 5 && isError) { setIsError(false); } - // if (newCode.join("").length === 4) { - // handleReq(); - // } - setCode(newCode); - if (val && index < inputRefs.length - 1) { inputRefs[index + 1].current?.focus(); } }; - 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("")); - - // 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 (
    { - setIsSendMsg && setIsSendMsg(true); - setStep && setStep((prev) => prev + 1); - if (code.join("").length !== 4) { - setIsError(true); - } else { - handleReq(); - } - }} - className="!rounded-[8px] !bg-[#5559CE]" - > - تایید - + setStep={setStep} + setIsError={setIsError} + setLoading={setLoading} + setIsSendMsg={setIsSendMsg} + />
    ); } diff --git a/data/profile_other.json b/data/profile_other.json index 4d2a579..64fcf0a 100644 --- a/data/profile_other.json +++ b/data/profile_other.json @@ -208,7 +208,6 @@ "relation": "پسر عمو", "contact": { "phone": "+989121234567", - "email": "father@example.com", "address": "تهران، خیابان انقلاب، پلاک 12" } }, @@ -217,7 +216,6 @@ "relation": "خواهر", "contact": { "phone": "+989121234567", - "email": "father@example.com", "address": "تهران، خیابان انقلاب، پلاک 12" } } diff --git a/lib/ability.js b/lib/ability.js new file mode 100644 index 0000000..b4a3fa0 --- /dev/null +++ b/lib/ability.js @@ -0,0 +1,16 @@ +import { AbilityBuilder, createMongoAbility } from "@casl/ability"; + +export function defineAbilitiesFor(user) { + const { can, cannot, build } = new AbilityBuilder(createMongoAbility); + + if (user?.role === "admin") { + can("access", "Dashboard"); + } else if (user?.role === "manager") { + can("access", "Dashboard"); + } else { + can("access", "Dashboard"); + // cannot("access", "Dashboard"); + } + + return build(); +} diff --git a/lib/auth.js b/lib/auth.js new file mode 100644 index 0000000..40df985 --- /dev/null +++ b/lib/auth.js @@ -0,0 +1,8 @@ +import { cookies } from "next/headers"; + +export async function getUser() { + const cookieStore = cookies(); + const raw = cookieStore.get("user"); + if (!raw) return null; + return JSON.parse(raw.value); +} diff --git a/package-lock.json b/package-lock.json index 947ff0c..9de7c18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,8 @@ "name": "nobat724", "version": "0.1.0", "dependencies": { + "@casl/ability": "^6.7.3", + "@casl/react": "^5.0.0", "@emotion/cache": "^11.11.0", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.0", @@ -2102,6 +2104,28 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "license": "MIT" }, + "node_modules/@casl/ability": { + "version": "6.7.3", + "resolved": "https://registry.npmjs.org/@casl/ability/-/ability-6.7.3.tgz", + "integrity": "sha512-A4L28Ko+phJAsTDhRjzCOZWECQWN2jzZnJPnROWWHjJpyMq1h7h9ZqjwS2WbIUa3Z474X1ZPSgW0f1PboZGC0A==", + "license": "MIT", + "dependencies": { + "@ucast/mongo2js": "^1.3.0" + }, + "funding": { + "url": "https://github.com/stalniy/casl/blob/master/BACKERS.md" + } + }, + "node_modules/@casl/react": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@casl/react/-/react-5.0.0.tgz", + "integrity": "sha512-jiwr6uOBnQA7h0gs+RJIbFVF24Dw6JLiUPL4pfU0OEjWSJFCcYBz6RPU21XNciWL6xwFDOds81cHosuElxfdmw==", + "license": "MIT", + "peerDependencies": { + "@casl/ability": "^4.0.0 || ^5.1.0 || ^6.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/@csstools/normalize.css": { "version": "12.1.1", "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-12.1.1.tgz", @@ -6097,6 +6121,41 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ucast/core": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/@ucast/core/-/core-1.10.2.tgz", + "integrity": "sha512-ons5CwXZ/51wrUPfoduC+cO7AS1/wRb0ybpQJ9RrssossDxVy4t49QxWoWgfBDvVKsz9VXzBk9z0wqTdZ+Cq8g==", + "license": "Apache-2.0" + }, + "node_modules/@ucast/js": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@ucast/js/-/js-3.0.4.tgz", + "integrity": "sha512-TgG1aIaCMdcaEyckOZKQozn1hazE0w90SVdlpIJ/er8xVumE11gYAtSbw/LBeUnA4fFnFWTcw3t6reqseeH/4Q==", + "license": "Apache-2.0", + "dependencies": { + "@ucast/core": "^1.0.0" + } + }, + "node_modules/@ucast/mongo": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@ucast/mongo/-/mongo-2.4.3.tgz", + "integrity": "sha512-XcI8LclrHWP83H+7H2anGCEeDq0n+12FU2mXCTz6/Tva9/9ddK/iacvvhCyW6cijAAOILmt0tWplRyRhVyZLsA==", + "license": "Apache-2.0", + "dependencies": { + "@ucast/core": "^1.4.1" + } + }, + "node_modules/@ucast/mongo2js": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@ucast/mongo2js/-/mongo2js-1.4.0.tgz", + "integrity": "sha512-vR9RJ3BHlkI3RfKJIZFdVktxWvBCQRiSTeJSWN9NPxP5YJkpfXvcBWAMLwvyJx4HbB+qib5/AlSDEmQiuQyx2w==", + "license": "Apache-2.0", + "dependencies": { + "@ucast/core": "^1.6.1", + "@ucast/js": "^3.0.0", + "@ucast/mongo": "^2.4.0" + } + }, "node_modules/@ungap/structured-clone": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.1.tgz", diff --git a/package.json b/package.json index 4891b64..2fdcd99 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,8 @@ "lint": "next lint" }, "dependencies": { + "@casl/ability": "^6.7.3", + "@casl/react": "^5.0.0", "@emotion/cache": "^11.11.0", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.0", diff --git a/services/api.js b/services/api.js index 7f2cf92..41b8a49 100644 --- a/services/api.js +++ b/services/api.js @@ -5,7 +5,6 @@ import "react-toastify/dist/ReactToastify.css"; const BASE_URL = process.env.NEXT_PUBLIC_API_URL; const token = Cookies.get("access"); -console.log(token); const api = axios.create({ baseURL: BASE_URL, @@ -17,11 +16,9 @@ const api = axios.create({ api.interceptors.response.use( (response) => { - console.log(response); return response.data; }, (error) => { - console.error(error); return Promise.reject(error); } ); diff --git a/services/response.js b/services/response.js index 4f3e0fa..b55aeb1 100644 --- a/services/response.js +++ b/services/response.js @@ -1,30 +1,31 @@ import api from "./api"; export const request = { - sendCode: (mobile_number) => + sendCode: (mobile, captcha_token) => api.post( - "api/v1/user/auth", - { mobile_number }, + "api/v1/user/send-code", + { + mobile, + captcha_token, + }, { headers: { Authorization: "", - withCredentials: true, }, } ), - getToken: (grant_type, client_id, client_secret, mobile_number, code) => { + getToken: (grant_type, client_id, client_secret, uuid, code) => { const formData = new URLSearchParams(); formData.append("grant_type", grant_type); formData.append("client_id", client_id); formData.append("client_secret", client_secret); - formData.append("mobile_number", mobile_number); + formData.append("uuid", uuid); formData.append("code", code); return api.post("oauth/token", formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", Authorization: "", - withCredentials: true, }, }); },