chore: file formatting
This commit is contained in:
+11
-11
@@ -1,5 +1,5 @@
|
||||
import apiClient from "@/api/client";
|
||||
import toast from "react-hot-toast";
|
||||
import apiClient from '@/api/client';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
export interface Doctor {
|
||||
doctorId: string;
|
||||
@@ -27,7 +27,7 @@ export interface Doctor {
|
||||
}
|
||||
|
||||
export const getDoctorsApi = async () => {
|
||||
const res = await apiClient.get("/doctors/getAll?admin=true");
|
||||
const res = await apiClient.get('/doctors/getAll?admin=true');
|
||||
return res.data;
|
||||
};
|
||||
|
||||
@@ -38,13 +38,13 @@ export const getDoctorByIdApi = async (doctorId: string) => {
|
||||
|
||||
export const createDoctorApi = async (data: Doctor) => {
|
||||
try {
|
||||
const res = await apiClient.post("/doctors", data);
|
||||
const res = await apiClient.post('/doctors', data);
|
||||
|
||||
toast.success("Doctor created successfully");
|
||||
toast.success('Doctor created successfully');
|
||||
|
||||
return res.data;
|
||||
} catch (error: any) {
|
||||
toast.error(error?.response?.data?.message || "Failed to create doctor");
|
||||
toast.error(error?.response?.data?.message || 'Failed to create doctor');
|
||||
|
||||
throw error;
|
||||
}
|
||||
@@ -53,16 +53,16 @@ export const createDoctorApi = async (data: Doctor) => {
|
||||
export const updateDoctorApi = async (
|
||||
doctorId: string,
|
||||
data: Partial<Doctor>,
|
||||
action: "toggleStatus" | "updateDetails" = "updateDetails",
|
||||
action: 'toggleStatus' | 'updateDetails' = 'updateDetails'
|
||||
) => {
|
||||
try {
|
||||
const res = await apiClient.patch(`/doctors/${doctorId}/${action}`, data);
|
||||
|
||||
toast.success("Doctor updated successfully");
|
||||
toast.success('Doctor updated successfully');
|
||||
|
||||
return res.data;
|
||||
} catch (error: any) {
|
||||
toast.error(error?.response?.data?.message || "Failed to update doctor");
|
||||
toast.error(error?.response?.data?.message || 'Failed to update doctor');
|
||||
|
||||
throw error;
|
||||
}
|
||||
@@ -72,11 +72,11 @@ export const deleteDoctorApi = async (doctorId: string) => {
|
||||
try {
|
||||
const res = await apiClient.delete(`/doctors/${doctorId}`);
|
||||
|
||||
toast.success("Doctor deleted successfully");
|
||||
toast.success('Doctor deleted successfully');
|
||||
|
||||
return res.data;
|
||||
} catch (error: any) {
|
||||
toast.error(error?.response?.data?.message || "Failed to delete doctor");
|
||||
toast.error(error?.response?.data?.message || 'Failed to delete doctor');
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user