diff --git a/app/component/element/Field.js b/app/component/element/Field.js index a4b2020..c23ae5e 100644 --- a/app/component/element/Field.js +++ b/app/component/element/Field.js @@ -4,7 +4,7 @@ import { styleTextSelectRight } from "@/mui"; function Field({ title, error, - spaceNull, + placeholder, inputProps, type, dir, @@ -21,6 +21,7 @@ function Field({ onChange={(e) => updateState(e.target.value)} className="!w-full !mx-auto !bg-[#FFF]" InputProps={inputProps} + placeholder={placeholder || ""} sx={{ ".MuiOutlinedInput-notchedOutline.muirtl-1d3z3hw-MuiOutlinedInput-notchedOutline": { @@ -36,8 +37,8 @@ function Field({ MozAppearance: "textfield", }, "& .MuiInputBase-input": { - padding: spaceNull ? "12.5px 0" : "12.5px 14px", - color: spaceNull && "#0009", + padding: "12.5px 14px", + color: "#0009", }, "& .MuiInputBase-root": { borderRadius: "6px !important" }, "& .MuiOutlinedInput-notchedOutline": { diff --git a/app/dashboard/page.js b/app/dashboard/page.js index 7d8d8a7..4010100 100644 --- a/app/dashboard/page.js +++ b/app/dashboard/page.js @@ -13,33 +13,17 @@ export default async function Dashboard({ searchParams }) { const ability = defineAbilitiesFor(user); const cookieStore = cookies(); const token = cookieStore.get("access_token"); - const userInfo = cookieStore.get("userInfo"); if (!ability.can("access", "Dashboard")) { removeToken(); return redirect("/login"); } - const response = await fetchReq( - `https://back-dev.clinic-pro.ir/api/v1/user-profile/${JSON.parse(userInfo?.value).uuid}`, - { - headers: { - Authorization: `Bearer ${token.value}`, - }, - } - ); - - const userAgent = headers().get("user-agent") || ""; - const isMobile = /Mobi|Android/i.test(userAgent); - return ( ); } diff --git a/components/clinic/index.js b/components/clinic/index.js index 58b1fcd..e074738 100644 --- a/components/clinic/index.js +++ b/components/clinic/index.js @@ -12,7 +12,6 @@ const listTab = ["درباره کلینیک", "اطلاعات تماس", "پزش function ClinicPage({ data, doctors }) { const [value, setValue] = useState(0); const handleChange = (event, newValue) => setValue(newValue); - console.log(data); const Components = [ , diff --git a/components/clinics/index.js b/components/clinics/index.js index d0f6029..2baa2bb 100644 --- a/components/clinics/index.js +++ b/components/clinics/index.js @@ -11,7 +11,6 @@ import specialtiesData from "@/data/specialties.json"; function ClinicsPage({ clinics, matchedCity, matchedState }) { const router = useRouter(); const [filteredClinics, setFilteredClinics] = useState(clinics); - console.log(clinics); const [selected, setSelected] = useState({ province: matchedState?.name || "", diff --git a/components/dashboard/Content.js b/components/dashboard/Content.js index 06c144b..5f85b20 100644 --- a/components/dashboard/Content.js +++ b/components/dashboard/Content.js @@ -5,29 +5,11 @@ import { useState } from "react"; import userData from "@/data/userData.json"; import DashboardPage from "@/components/dashboard"; import UserAccountPage from "./userAccount"; -import { request } from "@/services/response"; -function Content({ - matchedCity, - userInfo, - params, - logged, - initialIsOpenSide, - dataUser, -}) { +function Content({ matchedCity, params, logged }) { const [value, setValue] = useState(Number(params?.sidebar) || 0); - const [isOpenSide, setIsOpenSide] = useState(initialIsOpenSide); + const [isOpenSide, setIsOpenSide] = useState(); const [isTurnsDetails, setIsTurnsDetails] = useState(false); - const [prevData, setPrevData] = useState(dataUser); - - const updateDataUser = () => { - request - .getUserProfile(userInfo.uuid) - .then((res) => { - setPrevData(res); - }) - .catch(() => {}); - }; return ( diff --git a/components/dashboard/userAccount/detailUser/allergies/index.js b/components/dashboard/userAccount/detailUser/allergies/index.js index 10778a4..bedd1b6 100644 --- a/components/dashboard/userAccount/detailUser/allergies/index.js +++ b/components/dashboard/userAccount/detailUser/allergies/index.js @@ -5,8 +5,7 @@ import ItemAllergie from "./ItemAllergie"; import ModalAddAlergie from "./modal"; function Allergies({ data, changeData, updateData, loading }) { - const allergies = - data && data.other && data.other[0] && data.other[0].allergies; + const allergies = data && data.other && data.other.allergies; const tableHead = ["ردیف", "ماده آلرژی‌زا", "واکنش", "شدت", ""]; const centerTable = [0]; const [open, setOpen] = useState(false); @@ -22,13 +21,13 @@ function Allergies({ data, changeData, updateData, loading }) { changeData={changeData} /> - {allergies.length ? ( + {allergies?.length ? ( - {allergies.map((row, idx) => ( + {allergies?.map((row, idx) => ( { - const newDisease = data.other[0].disease?.map((item, index) => + const newDisease = data.other.disease?.map((item, index) => index === id ? { ...item, status: payload } : item ); const newData = { ...data, - other: [ - { - ...data.other[0], - disease: newDisease, - }, - ], + other: { + ...data.other, + disease: newDisease, + }, }; setData(newData); diff --git a/components/dashboard/userAccount/detailUser/familyHistory/index.js b/components/dashboard/userAccount/detailUser/familyHistory/index.js index 327eb98..6a4b3ed 100644 --- a/components/dashboard/userAccount/detailUser/familyHistory/index.js +++ b/components/dashboard/userAccount/detailUser/familyHistory/index.js @@ -5,8 +5,7 @@ import ModalAddHistory from "./modal"; import ItemHistory from "./ItemHistory"; function FamilyHistory({ data, changeData, loading, updateData }) { - const family_history = - data && data.other && data.other[0] && data.other[0].family_history; + const family_history = data && data.other && data.other.family_history; const tableHead = ["ردیف", "بیماری", "نسبت خانوادگی", ""]; const centerTable = [0]; const [open, setOpen] = useState(false); @@ -22,13 +21,13 @@ function FamilyHistory({ data, changeData, loading, updateData }) { updateData={updateData} /> - {family_history.length ? ( + {family_history?.length ? ( - {family_history.map((row, idx) => ( + {family_history?.map((row, idx) => ( { switch (action) { case "update": - newData.other[0][name][id] = payload; + newData.other[name][id] = payload; break; case "add": - newData.other[0][name].push(payload); + newData.other[name].push(payload); break; case "delete": - newData.other[0][name].splice(id, 1); + newData.other[name].splice(id, 1); break; default: diff --git a/components/dashboard/userAccount/detailUser/index.js b/components/dashboard/userAccount/detailUser/index.js index 1338522..3f1f28b 100644 --- a/components/dashboard/userAccount/detailUser/index.js +++ b/components/dashboard/userAccount/detailUser/index.js @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useState } from "react"; import HeadTab from "../content/HeadTab"; import { request } from "@/services/response"; import { setNewData } from "./function"; @@ -11,71 +11,13 @@ import Allergies from "./allergies"; import Surgeries from "./surgeries"; import FamilyHistory from "./familyHistory"; import Relatives from "./relatives"; -import { dieses } from "./information/dieses"; +import { removeAdditionalKeysDashboard } from "@/helper"; import Cookies from "js-cookie"; -import { getParsedUserInfo } from "@/helper"; -function DetailUser({ - user, - dataUser, - userInfo, - isTurnsDetails, - updateDataUser, - setIsTurnsDetails, -}) { +function DetailUser({ user, isTurnsDetails, setIsTurnsDetails }) { const [tab, setTab] = useState(0); const [information, setInformation] = useState(); - const [prevInfo, setPrevInfo] = useState(); - const initialData = { - name: dataUser?.name, - description: dataUser?.description, - birthday: dataUser?.birthday, - basic_insurance: [dataUser?.basic_insurance?.id], - blood_type: dataUser?.blood_type, - education: dataUser?.education, - fathers_name: dataUser?.fathers_name, - gender: dataUser?.gender, - home_phone: dataUser?.home_phone, - job: dataUser?.job, - marital_status: dataUser?.marital_status, - supplementary_insurance: dataUser?.supplementary_insurance, - work_phone: dataUser?.work_phone, - address: dataUser?.address, - other: dataUser?.other, - national_code: dataUser?.national_code, - }; - useEffect(() => { - const parsedUserInfo = getParsedUserInfo(); - - if (parsedUserInfo) { - request - .getUserProfile(parsedUserInfo.uuid) - .then((res) => { - setInformation(res); - setPrevInfo(res); - }) - .catch((err) => { - console.log(err); - }); - } else { - // handle Error - } - }, []); - - if (!dataUser) { - initialData.other = [ - { - disease: dieses, - allergies: [], - medications: [], - surgeries: [], - family_history: [], - relatives: [], - }, - ]; - } - const [data, setData] = useState(initialData); const [loading, setLoading] = useState(false); const listTab = [ @@ -90,9 +32,14 @@ function DetailUser({ const handleChange = (_, newValue) => setTab(newValue); const updateData = () => { + const usedKays = removeAdditionalKeysDashboard(information); setLoading(true); request - .patchUserProfile(data, dataUser.uuid) + .patchUserProfile( + usedKays, + information?.uuid, + Cookies.get("access_token") + ) .then(() => { setLoading(false); }) @@ -101,55 +48,42 @@ function DetailUser({ }); }; const changeData = (action, name, id, payload) => - setNewData(action, name, id, payload, data, setData); + setNewData(action, name, id, payload, information, setInformation); const components = [ - , + , , , , , , ); } diff --git a/components/dashboard/userAccount/detailUser/information/ButtonSendData.js b/components/dashboard/userAccount/detailUser/information/ButtonSendData.js new file mode 100644 index 0000000..9f6d182 --- /dev/null +++ b/components/dashboard/userAccount/detailUser/information/ButtonSendData.js @@ -0,0 +1,109 @@ +import ArrowLeftWhiteD from "@/components/icons/ArrowLeftWhiteD"; +import { + handleTimeExpiresToken, + removeAdditionalKeysDashboard, +} from "@/helper"; +import { request } from "@/services/response"; +import { Button } from "@mui/material"; +import Cookies from "js-cookie"; + +function ButtonSendData({ + loading, + errors, + information, + setInformation, + setLoading, + setErrors, +}) { + const handleErrReq = (err) => { + const errors = err?.response?.data; + if (errors) { + setErrors(typeof errors === "string" ? {} : errors); + } + setLoading(false); + }; + + const postData = () => { + request + .postUserProfile(information) + .then((response) => { + if (response.uuid) { + const formData = new URLSearchParams(); + formData.append("grant_type", "refresh_token"); + formData.append("client_id", process.env.NEXT_PUBLIC_CLIENT_ID); + formData.append( + "client_secret", + process.env.NEXT_PUBLIC_CLIENT_SECRET + ); + formData.append("refresh_token", Cookies.get("refresh_token")); + + request + .postRefreshToken(formData) + .then((res) => { + const expiresTime = handleTimeExpiresToken(res.expires_in); + Cookies.set("access_token", res.access_token, { + expires: expiresTime.accessTokenExpires, + path: "/", + secure: true, + sameSite: "strict", + }); + + setInformation({ + ...information, + prev_data: true, + uuid: response.uuid, + }); + setLoading(false); + }) + .catch((err) => { + setLoading(false); + }); + } + }) + .catch((err) => { + handleErrReq(err); + }); + }; + + const patchData = () => { + const usedKays = removeAdditionalKeysDashboard(information); + + request + .patchUserProfile( + usedKays, + information?.uuid, + Cookies.get("access_token") + ) + .then(() => { + setLoading(false); + }) + .catch((err) => handleErrReq(err)); + }; + + const sendReq = () => { + setLoading(true); + + information.prev_data ? patchData() : postData(); + }; + const isDisabled = () => { + return loading || Object.values(errors).some(Boolean) || !information; + }; + + return ( + + ); +} + +export default ButtonSendData; diff --git a/components/dashboard/userAccount/detailUser/information/Form.js b/components/dashboard/userAccount/detailUser/information/Form.js index 5a8f04c..c19db60 100644 --- a/components/dashboard/userAccount/detailUser/information/Form.js +++ b/components/dashboard/userAccount/detailUser/information/Form.js @@ -11,20 +11,14 @@ import { job, } from "./listSelector"; -function Form({ - data, - userInfo, - insurance, - errors, - prevInfo, - changeData, - prevData, -}) { +function Form({ insurance, errors, changeData, information }) { const findVal = (list, name) => - data && list && list.length && list.find((g) => g.id === data[name]); - console.log(errors); + list && + list.length && + information && + information[name] && + list.find((g) => g.id === information[name]); const parsedUserInfo = getParsedUserInfo(); - console.log(parsedUserInfo); return (
@@ -36,7 +30,7 @@ function Form({ name="work_phone" isTransparent={true} changeData={changeData} - data={userInfo?.username} + data={parsedUserInfo?.username} /> @@ -47,8 +41,8 @@ function Form({ name="national_code" isTransparent={true} changeData={changeData} - data={data?.national_code} - disable={prevInfo && prevInfo.national_code} + data={information?.national_code} + disable={information?.prev_data} /> @@ -57,7 +51,7 @@ function Form({ isTransparent={true} iconGray={true} changeData={changeData} - data={data?.name} + data={information?.name} name="name" /> @@ -67,7 +61,7 @@ function Form({ isTransparent={true} iconGray={true} changeData={changeData} - data={data?.family} + data={information?.family} name="family" /> @@ -86,7 +80,7 @@ function Form({ @@ -97,18 +91,23 @@ function Form({ isTransparent={true} iconGray={true} changeData={changeData} - data={data?.fathers_name} + data={information?.fathers_name} name="fathers_name" /> - + { changeData([Number(val.id)], name); }} // value={findVal(insurance, "basic_insurance", true)?.name} value={insurance?.find( - (g) => Number(g.id) === data.basic_insurance[0] + (g) => + Number(g.id) === + (information?.basic_insurance + ? information?.basic_insurance[0] + : false) )} name="basic_insurance" label="نوع بیمه" @@ -126,9 +125,9 @@ function Form({ iconGray={true} type="number" changeData={changeData} - data={data?.insurance_id} + data={information?.insurance_id} name="insurance_id" - // data={data?.supplementary_insurance} + // data={information?.supplementary_insurance} // name="supplementary_insurance" /> @@ -162,7 +161,7 @@ function Form({ iconGray={true} type="number" changeData={changeData} - data={data?.home_phone} + data={information?.home_phone} name="home_phone" /> @@ -170,10 +169,7 @@ function Form({ - changeData( - education.find((g) => g.label === value).id, - name - ) + changeData(education.find((g) => g.label === value).id, name) } value={findVal(education, "education")} label="تحصیلات" @@ -199,7 +195,7 @@ function Form({ type="number" iconGray={true} changeData={changeData} - data={data?.work_phone} + data={information?.work_phone} name="work_phone" /> diff --git a/components/dashboard/userAccount/detailUser/information/dieses.js b/components/dashboard/userAccount/detailUser/information/disease.js similarity index 98% rename from components/dashboard/userAccount/detailUser/information/dieses.js rename to components/dashboard/userAccount/detailUser/information/disease.js index 8b9ef16..64f1a6c 100644 --- a/components/dashboard/userAccount/detailUser/information/dieses.js +++ b/components/dashboard/userAccount/detailUser/information/disease.js @@ -1,4 +1,4 @@ -export const dieses = [ +export const disease = [ { id: 1, name: "فشار خون", diff --git a/components/dashboard/userAccount/detailUser/information/index.js b/components/dashboard/userAccount/detailUser/information/index.js index e070ef1..13da818 100644 --- a/components/dashboard/userAccount/detailUser/information/index.js +++ b/components/dashboard/userAccount/detailUser/information/index.js @@ -1,34 +1,49 @@ import { useEffect, useState } from "react"; import Form from "./Form"; -import { Button } from "@mui/material"; -import ArrowLeftWhiteD from "@/components/icons/ArrowLeftWhiteD"; import { request } from "@/services/response"; -import Cookies from "js-cookie"; +import ButtonSendData from "./ButtonSendData"; +import { getParsedUserInfo } from "@/helper"; +import { disease } from "../information/disease"; -function Information({ - user, - data, - setData, - userInfo, - prevInfo, - dataUser, - initialData, - information, - setInformation, - updateDataUser, -}) { - const [disable, setDisable] = useState(true); - const [insurance, setInsurance] = useState(); +function Information({ information, setInformation }) { const [loading, setLoading] = useState(false); + const [insurance, setInsurance] = useState(); const [errors, setErrors] = useState({}); useEffect(() => { + const parsedUserInfo = getParsedUserInfo(); + request.getInsuranceType().then((res) => { if (res && res.data) { setInsurance(res.data); } }); - // .catch((err) => {}); + + if (parsedUserInfo) { + request + .getUserProfile(parsedUserInfo.uuid) + .then((res) => { + const changedData = res; + changedData.basic_insurance = [Number(res?.basic_insurance?.id)]; + changedData.prev_data = true; + setInformation(changedData); + }) + .catch((err) => { + if (err?.response?.data === "Entity not found") { + setInformation({ + prev_data: false, + other: { + disease: disease, + allergies: [], + medications: [], + surgeries: [], + family_history: [], + relatives: [], + }, + }); + } + }); + } }, []); const changeData = (value, name) => { @@ -37,70 +52,29 @@ function Information({ [name]: value, }); if (errors && errors[name]) { - setErrors({ - ...errors, + setErrors((prevErrors) => ({ + ...prevErrors, [name]: false, - }); + })); } }; - console.log(information); - - const validationInfo = () => {}; - - const sendReq = () => { - setLoading(true); - console.log(prevInfo); - console.log(prevInfo ? true : false); - console.log(information); - - if (!validationInfo()) - request[prevInfo ? "patchUserProfile" : "postUserProfile"]( - information, - prevInfo ? prevInfo.uuid : Cookies.get("uuid") - ) - .then((res) => { - console.log(res); - - if (!dataUser) { - updateDataUser(); - } - setLoading(false); - }) - .catch((err) => { - console.log(err); - console.log(err?.response?.data); - if (err?.response?.data) { - setErrors(err.response.data); - } - - setLoading(false); - }); - }; return (
- + errors={errors} + />
); } diff --git a/components/dashboard/userAccount/detailUser/medications/index.js b/components/dashboard/userAccount/detailUser/medications/index.js index f2f71bf..f6ef408 100644 --- a/components/dashboard/userAccount/detailUser/medications/index.js +++ b/components/dashboard/userAccount/detailUser/medications/index.js @@ -5,8 +5,7 @@ import ItemMedication from "./ItemMedication"; import ModalAddMedications from "./modal"; function Medications({ data, changeData, updateData, loading }) { - const medications = - data && data.other && data.other[0] && data.other[0].medications; + const medications = data && data.other && data.other.medications; const tableHead = ["ردیف", "نام دارو", "دوز مصرفی", "تعداد و زمان مصرف", ""]; const centerTable = [0]; const [open, setOpen] = useState(false); @@ -22,13 +21,13 @@ function Medications({ data, changeData, updateData, loading }) { changeData={changeData} /> - {medications.length ? ( + {medications?.length ? ( - {medications.map((row, idx) => ( + {medications?.map((row, idx) => ( - {relatives.length ? ( + {relatives?.length ? ( - {relatives.map((row, idx) => ( + {relatives?.map((row, idx) => ( - {surgeries.length ? ( + {surgeries?.length ? ( - {surgeries.map((row, idx) => ( + {surgeries?.map((row, idx) => ( , , diff --git a/components/register/LogInPage.js b/components/register/LogInPage.js index 0d20311..9d384b5 100644 --- a/components/register/LogInPage.js +++ b/components/register/LogInPage.js @@ -1,9 +1,5 @@ import Field from "@/app/component/element/Field"; -import { - changeNumToDefault, - formatPhoneNumber, - validatePhoneNumber, -} from "@/helper"; +import { validatePhoneNumber } from "@/helper"; import { request } from "@/services/response"; import { InputAdornment, Button } from "@mui/material"; import Link from "next/link"; @@ -14,15 +10,14 @@ function LogInPage({ setIsSendMsg, num, setNum, setUuid, matchedCity }) { const [loading, setLoading] = useState(false); const handleChange = (val) => { - const formatted = formatPhoneNumber(val); - const checkedNum = validatePhoneNumber(formatted); + const checkedNum = validatePhoneNumber(val); setError(checkedNum); - setNum(formatted); + setNum(val); }; const handleReq = async () => { setLoading(true); request - .sendCode(changeNumToDefault(num), "") + .sendCode(num, "") .then((response) => { setLoading(false); if (response.uuid) { @@ -52,26 +47,7 @@ function LogInPage({ setIsSendMsg, num, setNum, setUuid, matchedCity }) { value={num} type="tel" error={!error.valid} - spaceNull={true} - inputProps={{ - startAdornment: ( - - 09 - - ), - }} - title="شماره همراه" + placeholder="09xxxxxxxxx" updateState={handleChange} />

{ - const accessTokenExpires = new Date(); - accessTokenExpires.setSeconds( - accessTokenExpires.getSeconds() + response.expires_in - ); - const refreshTokenExpires = new Date(); - refreshTokenExpires.setDate(refreshTokenExpires.getDate() + 30); + const expiresTime = handleTimeExpiresToken(response.expires_in); Cookies.set("access_token", response.access_token, { - expires: accessTokenExpires, + expires: expiresTime.accessTokenExpires, path: "/", secure: true, sameSite: "strict", }); Cookies.set("refresh_token", response.refresh_token, { - expires: refreshTokenExpires, + expires: expiresTime.refreshTokenExpires, path: "/", secure: true, sameSite: "strict", }); Cookies.set("uuid", uuid, { - expires: refreshTokenExpires, + expires: expiresTime.refreshTokenExpires, path: "/", secure: true, sameSite: "strict", diff --git a/helper/index.js b/helper/index.js index 6d9fe58..111dd4c 100644 --- a/helper/index.js +++ b/helper/index.js @@ -123,17 +123,15 @@ export const formatPhoneNumber = (input) => { }; export function validatePhoneNumber(input) { - const digits = input.replace(/\D/g, ""); - - if (!digits) { + if (!input) { return { valid: false, text: "شماره موبایل نمی‌تواند خالی باشد." }; } - if (digits.length !== 9) { + if (input.length !== 11) { return { valid: false, text: "شماره موبایل باید دقیقا 11 رقم باشد." }; } - const isValid = /^[1-9]\d{8}$/.test(digits); + const isValid = /^09\d{9}$/.test(input); if (!isValid) { return { valid: false, text: "شماره موبایل نامعتبر است." }; } @@ -185,8 +183,6 @@ export function getCleanNumberValue(value, defaultValue = 0) { return isNaN(number) ? defaultValue : number; } -export const changeNumToDefault = (num) => `09${num.replace(/\D/g, "")}`; - export function hasDataChanged(previousData, newData) { const oldDataString = JSON.stringify( previousData, @@ -201,3 +197,30 @@ export const getParsedUserInfo = () => { const parsedUserInfo = user && JSON.parse(user); return parsedUserInfo; }; + +export const handleTimeExpiresToken = (expires_in) => { + const accessTokenExpires = new Date(); + accessTokenExpires.setSeconds(accessTokenExpires.getSeconds() + expires_in); + const refreshTokenExpires = new Date(); + refreshTokenExpires.setDate(refreshTokenExpires.getDate() + 30); + + return { + accessTokenExpires, + refreshTokenExpires, + }; +}; + +export const removeAdditionalKeysDashboard = (information) => { + const { + national_code, + changed, + created, + id, + status, + prev_data, + uuid, + ...usedKays + } = information; + + return usedKays; +}; diff --git a/services/response.js b/services/response.js index 5df3556..6f29e83 100644 --- a/services/response.js +++ b/services/response.js @@ -29,10 +29,22 @@ export const request = { }, }); }, + postRefreshToken: (formData) => { + return api.post("oauth/token", formData, { + headers: { + "Content-Type": "application/x-www-form-urlencoded", + Authorization: "", + }, + }); + }, getUserProfile: (uuid) => api.get(`/api/v1/user-profile/${uuid}`), postUserProfile: (data) => api.post("api/v1/user-profile", data), - patchUserProfile: (data, uuid) => - api.patch(`api/v1/user-profile/${uuid}`, data), + patchUserProfile: (data, uuid, token) => + api.patch(`api/v1/user-profile/${uuid}`, data, { + headers: { + Authorization: `Bearer ${token}`, + }, + }), getUserInfo: (headers) => api.get("oauth/userinfo", headers), getInsuranceType: () => api.get("api/v1/categorys/insurance_type", { @@ -40,4 +52,12 @@ export const request = { Authorization: "", }, }), + getAppointmentWeeklySchedule: (uuid) => + api.get(`api/v1/appointment-settings/weekly-schedule/${uuid}`), + postAppointmentWeeklySchedule: () => + api.post("api/v1/appointment-settings/weekly-schedule/"), + patchAppointmentWeeklySchedule: (uuid) => + api.patch(`api/v1/appointment-settings/weekly-schedule/${uuid}`), + deleteAppointmentWeeklySchedule: (uuid) => + api.delete(`api/v1/appointment-settings/weekly-schedule/${uuid}`), };