Files
nobat724_front/services/response.js
T
hamedandClaude Opus 4.8 d8ab26b4b7 feat(doctor): claim-profile section + modal for unclaimed IRIMC-imported doctors
- ClaimProfileSection (components/doctor/claim): shown only when
  doctor.owner_status === "unclaimed"; banner explains the profile is not
  yet managed by the doctor, button "تأیید و مدیریت این پروفایل"
- Modal: login prompt when logged out; otherwise first/last name,
  national code, Jalali birth-date (existing JalaliDatePicker) — posts to
  POST api/v1/doctor/{uuid}/claim (identity verified server-side via API.ir;
  no client call to API.ir, no token exposure)
- States: loading, per-field validation, server error (Persian envelope
  message), double-submit guard, success welcome message + redirect
- Shared component across main domain and all representative subdomains
- services/response.js: getDoctorClaimInfo / postDoctorClaim

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 11:44:40 +03:30

137 lines
5.0 KiB
JavaScript

import { removeTokenHead } from "@/helper";
import api from "./api";
export const request = {
sendCode: (mobile, altcha, domain) =>
api.post(
"api/v1/user/send-code",
{
mobile,
altcha,
...(domain ? { domain } : {}),
},
removeTokenHead
),
getUserProfile: (uuid) => api.get(`/api/v1/user-profile/${uuid}`, { requireAuth: true }),
postUserProfile: (data) => api.post("api/v1/user-profile", data, { requireAuth: true }),
patchUserProfile: (data, uuid) =>
api.patch(`api/v1/user-profile/${uuid}`, data, { requireAuth: true }),
uploadUserAvatar: (file) =>
api.post("api/v1/user-profile/avatar", file, {
requireAuth: true,
headers: {
"Content-Type": "application/octet-stream",
"Content-Disposition": `filename="${file?.name || "avatar.jpg"}"`,
},
}),
getUserInfo: (headers) => api.get("oauth/userinfo", { ...headers, requireAuth: true }),
getInsuranceType: () =>
api.get(`api/v1/insurances?type=basic`, { requireAuth: true }),
getSupplementaryInsurance: () =>
api.get(`api/v1/insurances?type=supplementary`, { requireAuth: true }),
getDoctors: (params) =>
api.get("api/v1/doctors", {
params,
headers: {
Authorization: "",
},
}),
getSpecialtyDoctorCounts: (cityId) =>
api.get("api/v1/specialties/doctor-counts", {
params: cityId ? { city_id: cityId } : {},
headers: { 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}`),
getAppointmentSlots: (doctor_uuid, date) =>
api.get(
`api/v1/appointment-slots?doctor_uuid=${doctor_uuid}&date=${date}`,
removeTokenHead
),
getMonthAvailability: (doctor_uuid, year, month) =>
api.get(`api/v1/appointment-settings/month-availability/${doctor_uuid}`, {
params: { year, month },
...removeTokenHead,
}),
postAppointment: (data) => api.post(`api/v1/appointment`, data, { requireAuth: true }),
getMyAppointments: (params) => api.get(`api/v1/appointments/user`, { params, requireAuth: true }),
getPaymentConfig: () => api.get(`api/v1/payment/config`, { requireAuth: true }),
getPayment: (uuid) => api.get(`api/v1/payment/${uuid}`, { requireAuth: true }),
getMyPayments: (params) => api.get(`api/v1/my/payments`, { params, requireAuth: true }),
postDoctor: (data) => api.post("api/v1/doctor", data),
postImageUpload: (data) =>
api.post("file/upload/clinic_pro/doctor/field_image", data, {
headers: {
"Content-Type": "application/octet-stream",
"Content-Disposition": `file; filename="${data.name}"`,
"X-CSRF-Token": "",
},
}),
getDoctorServices: () =>
api.get("api/v1/categorys/doctor_services", removeTokenHead),
postDoctorComment: (data) => api.post("api/v1/comment", data, { requireAuth: true }),
getDoctorClaimInfo: (uuid) => api.get(`api/v1/doctor/${uuid}/claim-info`),
postDoctorClaim: (uuid, data) =>
api.post(`api/v1/doctor/${uuid}/claim`, data, { requireAuth: true }),
getDoctorRate: (uuid) => api.get(`api/v1/rate/${uuid}`),
getRateEligibility: (uuid) =>
api.get(`api/v1/rate/${uuid}/eligibility`, { requireAuth: true }),
getDoctorComments: (uuid) => api.get(`api/v1/comments/${uuid}`),
postDoctorRate: (data) => api.post("api/v1/rate", data, { requireAuth: true }),
postCommentsLike: (commentUuid, value) =>
api.post(`api/v1/like/${commentUuid}`, { value }, { requireAuth: true }),
getClinicList: (params) =>
api.get("/api/v1/clinics", {
params,
headers: {
Authorization: "",
},
}),
getDoctorAddress: (location_id) =>
api.get(`api/v1/clinic-pro/doctor-address/${location_id}`, removeTokenHead),
getBlogs: (params) =>
api.get("api/v1/blogs", {
params,
headers: {
Authorization: "",
},
}),
getBlogTags: (params) =>
api.get("api/v1/tags", {
params,
headers: {
Authorization: "",
},
}),
getTopBlogs: () =>
api.get("api/v1/blogs/top", {
headers: {
Authorization: "",
},
}),
getSingleBlog: (uuid) =>
api.get(`api/v1/blog/${uuid}`, {
headers: {
Authorization: "",
},
}),
getRepresentationInfo: (uuid) =>
api.get(`api/v1/representation/${uuid}`, { requireAuth: true }),
getRepresentationDashboardMonthly: (uuid, year, month) =>
api.get(`api/v1/representation/${uuid}/dashboard/monthly`, {
params: { year, month },
requireAuth: true,
}),
getRepresentationDashboardYearly: (uuid, year) =>
api.get(`api/v1/representation/${uuid}/dashboard/yearly`, {
params: { year },
requireAuth: true,
}),
};