Files
nobat724_front/services/response.js
T

102 lines
3.4 KiB
JavaScript

import { removeTokenHead } from "@/helper";
import api from "./api";
export const request = {
sendCode: (mobile, captcha_token) =>
api.post(
"api/v1/user/send-code",
{
mobile,
captcha_token,
},
removeTokenHead
),
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("uuid", uuid);
formData.append("code", code);
return api.post("oauth/token", formData, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "",
},
});
},
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, token) =>
api.patch(
`api/v1/user-profile/${uuid}`,
data,
token && {
headers: {
Authorization: `Bearer ${token}`,
},
}
),
getUserInfo: (headers) => api.get("oauth/userinfo", headers),
getInsuranceType: () =>
api.get("api/v1/categorys/insurance_type", removeTokenHead),
getDoctors: (params) =>
api.get("api/v1/doctors", {
params,
headers: {
Authorization: "",
},
}),
getAppointmentNotAvailable: (doctor_id) =>
api.get(`api/v1/appointment/not-available/${doctor_id}`, removeTokenHead),
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}`),
getAppointment: (doctor_id, date) =>
api.get(
`api/v1/appointment-slots?date=${date}&doctor_id=${doctor_id}`,
removeTokenHead
),
postAppointment: (data) => api.post(`api/v1/appointment`, data),
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/clinicpro/comment", data),
getDoctorRate: (uuid) => api.get(`api/v1/clinicpro/rate/${uuid}`),
postDoctorRate: (data) => api.post("api/v1/clinicpro/rate", data),
patchDoctorRate: (data, uuid) =>
api.patch(`api/v1/clinicpro/rate/${uuid}`, data),
postCommentsLike: (data) => api.post("/api/v1/clinicpro/like", data),
getClinicList: (params) =>
api.get("/api/v1/clinics", {
params,
headers: {
Authorization: "",
},
}),
getDoctorAddress: (location_id) =>
api.get(`api/v1/clinic-pro/doctor-address/${location_id}`, removeTokenHead),
};