chore: file formatting

This commit is contained in:
Kailasdevdas
2026-05-26 15:48:01 +05:30
parent 8a21e0bf38
commit 78e2618a29
117 changed files with 12775 additions and 14638 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import apiClient from "@/api/client";
import apiClient from '@/api/client';
export const getAcademicsApi = async () => {
const res = await apiClient.get("/academics/getAll");
const res = await apiClient.get('/academics/getAll');
return res.data;
};
+5 -5
View File
@@ -1,12 +1,12 @@
import apiClient from "@/api/client";
import apiClient from '@/api/client';
export const getAppointmentsApi = async (
page = 1,
limit = 10,
date = "",
startDate = "",
endDate = "",
search = "",
date = '',
startDate = '',
endDate = '',
search = ''
) => {
const params = new URLSearchParams({
page: String(page),
+3 -6
View File
@@ -1,10 +1,7 @@
import apiClient from "./client";
import apiClient from './client';
export const loginApi = async (
username: string,
password: string,
): Promise<any> => {
const response = await apiClient.post("/auth/login/", {
export const loginApi = async (username: string, password: string): Promise<any> => {
const response = await apiClient.post('/auth/login/', {
username,
password,
});
+6 -6
View File
@@ -1,4 +1,4 @@
import apiClient from "@/api/client";
import apiClient from '@/api/client';
export interface Blog {
id?: number;
@@ -9,7 +9,7 @@ export interface Blog {
}
export const getAllBlogsApi = async () => {
const res = await apiClient.get("/blogs");
const res = await apiClient.get('/blogs');
return res.data;
};
@@ -19,7 +19,7 @@ export const getBlogByIdApi = async (id: number) => {
};
export const createBlogApi = async (data: Blog) => {
const res = await apiClient.post("/blogs", data);
const res = await apiClient.post('/blogs', data);
return res.data;
};
@@ -36,11 +36,11 @@ export const deleteBlogApi = async (id: number) => {
/* IMAGE UPLOAD */
export const uploadImageApi = async (file: File) => {
const formData = new FormData();
formData.append("image", file);
formData.append('image', file);
const res = await apiClient.post("/upload/image", formData, {
const res = await apiClient.post('/upload/image', formData, {
headers: {
"Content-Type": "multipart/form-data",
'Content-Type': 'multipart/form-data',
},
});
+2 -2
View File
@@ -1,7 +1,7 @@
import apiClient from "@/api/client";
import apiClient from '@/api/client';
export const getCandidatesApi = async () => {
const res = await apiClient.get("/candidates/getAll");
const res = await apiClient.get('/candidates/getAll');
return res.data;
};
+10 -10
View File
@@ -1,20 +1,20 @@
import apiClient from "@/api/client";
import toast from "react-hot-toast";
import apiClient from '@/api/client';
import toast from 'react-hot-toast';
export const getCareersApi = async () => {
const res = await apiClient.get("/careers/getAll?admin=true");
const res = await apiClient.get('/careers/getAll?admin=true');
return res.data;
};
export const createCareerApi = async (data: any) => {
try {
const res = await apiClient.post("/careers", data);
const res = await apiClient.post('/careers', data);
toast.success("Career created successfully");
toast.success('Career created successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to create career");
toast.error(error?.response?.data?.message || 'Failed to create career');
throw error;
}
@@ -24,11 +24,11 @@ export const updateCareerApi = async (id: number, data: any) => {
try {
const res = await apiClient.patch(`/careers/${id}`, data);
toast.success("Career updated successfully");
toast.success('Career updated successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to update career");
toast.error(error?.response?.data?.message || 'Failed to update career');
throw error;
}
@@ -38,11 +38,11 @@ export const deleteCareerApi = async (id: number) => {
try {
const res = await apiClient.delete(`/careers/${id}`);
toast.success("Career deleted successfully");
toast.success('Career deleted successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to delete career");
toast.error(error?.response?.data?.message || 'Failed to delete career');
throw error;
}
+12 -12
View File
@@ -1,48 +1,48 @@
import axios from "axios";
import type {InternalAxiosRequestConfig} from "axios";
import axios from 'axios';
import type { InternalAxiosRequestConfig } from 'axios';
const baseURL: string = import.meta.env.VITE_API_URL;
const apiClient = axios.create({
baseURL: baseURL,
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json',
},
});
export const setAxiosAuthToken = (token: string | null): void => {
if (token) {
apiClient.defaults.headers.common["Authorization"] = `Bearer ${token}`;
apiClient.defaults.headers.common['Authorization'] = `Bearer ${token}`;
} else {
delete apiClient.defaults.headers.common["Authorization"];
delete apiClient.defaults.headers.common['Authorization'];
}
};
apiClient.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
const token = localStorage.getItem("token");
const token = localStorage.getItem('token');
if (token && config.headers) {
config.headers["Authorization"] = `Bearer ${token}`;
config.headers['Authorization'] = `Bearer ${token}`;
}
return config;
},
(error: any) => Promise.reject(error),
(error: any) => Promise.reject(error)
);
apiClient.interceptors.response.use(
(response) => response,
async (error) => {
if (error.response?.status === 401) {
console.error("Unauthorized - token missing or invalid");
console.error('Unauthorized - token missing or invalid');
localStorage.removeItem("token");
window.location.href = "/login";
localStorage.removeItem('token');
window.location.href = '/login';
}
return Promise.reject(error);
},
}
);
export default apiClient;
+11 -17
View File
@@ -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 Department {
departmentId: string;
@@ -15,7 +15,7 @@ export interface Department {
}
export const getDepartmentsApi = async () => {
const res = await apiClient.get("/departments/getAll?admin=true");
const res = await apiClient.get('/departments/getAll?admin=true');
return res.data;
};
@@ -29,15 +29,13 @@ export const createDepartmentApi = async (data: {
services?: string;
}) => {
try {
const res = await apiClient.post("/departments", data);
const res = await apiClient.post('/departments', data);
toast.success("Department created successfully");
toast.success('Department created successfully');
return res.data;
} catch (error: any) {
toast.error(
error?.response?.data?.message || "Failed to create department",
);
toast.error(error?.response?.data?.message || 'Failed to create department');
throw error;
}
@@ -52,18 +50,16 @@ export const updateDepartmentApi = async (
para3?: string;
facilities?: string;
services?: string;
},
}
) => {
try {
const res = await apiClient.put(`/departments/${departmentId}`, data);
toast.success("Department updated successfully");
toast.success('Department updated successfully');
return res.data;
} catch (error: any) {
toast.error(
error?.response?.data?.message || "Failed to update department",
);
toast.error(error?.response?.data?.message || 'Failed to update department');
throw error;
}
@@ -73,13 +69,11 @@ export const deleteDepartmentApi = async (departmentId: string) => {
try {
const res = await apiClient.delete(`/departments/${departmentId}`);
toast.success("Department deleted successfully");
toast.success('Department deleted successfully');
return res.data;
} catch (error: any) {
toast.error(
error?.response?.data?.message || "Failed to delete department",
);
toast.error(error?.response?.data?.message || 'Failed to delete department');
throw error;
}
+11 -11
View File
@@ -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;
}
+4 -7
View File
@@ -1,4 +1,4 @@
import apiClient from "@/api/client";
import apiClient from '@/api/client';
export interface EmailConfig {
id?: number;
@@ -10,21 +10,18 @@ export interface EmailConfig {
// GET ALL
export const getEmailConfigsApi = async () => {
const res = await apiClient.get("/email/getAll");
const res = await apiClient.get('/email/getAll');
return res.data;
};
// CREATE
export const createEmailConfigApi = async (data: EmailConfig) => {
const res = await apiClient.post("/email", data);
const res = await apiClient.post('/email', data);
return res.data;
};
// UPDATE
export const updateEmailConfigApi = async (
id: number,
data: Partial<EmailConfig>,
) => {
export const updateEmailConfigApi = async (id: number, data: Partial<EmailConfig>) => {
const res = await apiClient.patch(`/email/${id}`, data);
return res.data;
};
+25 -40
View File
@@ -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 SeoData {
seoTitle?: string;
@@ -56,36 +56,33 @@ export interface HealthInquiry {
}
export const getHealthCategoriesApi = async () => {
const res = await apiClient.get("/health-check/categories?admin=true");
const res = await apiClient.get('/health-check/categories?admin=true');
return res.data;
};
export const getHealthPackagesApi = async () => {
const res = await apiClient.get("/health-check/packages?admin=true");
const res = await apiClient.get('/health-check/packages?admin=true');
return res.data;
};
export const createHealthPackageApi = async (data: Partial<HealthPackage>) => {
try {
const res = await apiClient.post("/health-check", data);
toast.success("Package created successfully");
const res = await apiClient.post('/health-check', data);
toast.success('Package created successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to create package");
toast.error(error?.response?.data?.message || 'Failed to create package');
throw error;
}
};
export const updateHealthPackageApi = async (
id: number,
data: Partial<HealthPackage>,
) => {
export const updateHealthPackageApi = async (id: number, data: Partial<HealthPackage>) => {
try {
const res = await apiClient.patch(`/health-check/${id}`, data);
toast.success("Package updated successfully");
toast.success('Package updated successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to update package");
toast.error(error?.response?.data?.message || 'Failed to update package');
throw error;
}
};
@@ -93,27 +90,23 @@ export const updateHealthPackageApi = async (
export const deleteHealthPackageApi = async (id: number) => {
try {
const res = await apiClient.delete(`/health-check/${id}`);
toast.success("Package deleted successfully");
toast.success('Package deleted successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to delete package");
toast.error(error?.response?.data?.message || 'Failed to delete package');
throw error;
}
};
export const createCategoryApi = async (data: {
name: string;
slug: string;
sortOrder: number;
}) => {
export const createCategoryApi = async (data: { name: string; slug: string; sortOrder: number }) => {
try {
const res = await apiClient.post("/health-check/categories", data);
const res = await apiClient.post('/health-check/categories', data);
toast.success("Category created successfully");
toast.success('Category created successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to create category");
toast.error(error?.response?.data?.message || 'Failed to create category');
throw error;
}
@@ -123,11 +116,11 @@ export const updateCategoryApi = async (id: number, data: any) => {
try {
const res = await apiClient.patch(`/health-check/categories/${id}`, data);
toast.success("Category updated successfully");
toast.success('Category updated successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to update category");
toast.error(error?.response?.data?.message || 'Failed to update category');
throw error;
}
@@ -137,34 +130,26 @@ export const deleteCategoryApi = async (id: number) => {
try {
const res = await apiClient.delete(`/health-check/categories/${id}`);
toast.success("Category deleted successfully");
toast.success('Category deleted successfully');
return res.data;
} catch (error: any) {
toast.error(error?.response?.data?.message || "Failed to delete category");
toast.error(error?.response?.data?.message || 'Failed to delete category');
throw error;
}
};
export const getAllInquiriesApi = async (
page = 1,
limit = 10,
filterDate = "",
startDate = "",
endDate = "",
) => {
export const getAllInquiriesApi = async (page = 1, limit = 10, filterDate = '', startDate = '', endDate = '') => {
const params = new URLSearchParams({
page: page.toString(),
limit: limit.toString(),
});
if (filterDate) params.append("filterDate", filterDate);
if (startDate) params.append("startDate", startDate);
if (endDate) params.append("endDate", endDate);
if (filterDate) params.append('filterDate', filterDate);
if (startDate) params.append('startDate', startDate);
if (endDate) params.append('endDate', endDate);
const res = await apiClient.get(
`/health-check/inquiries?${params.toString()}`,
);
const res = await apiClient.get(`/health-check/inquiries?${params.toString()}`);
return res.data;
};
+2 -2
View File
@@ -1,7 +1,7 @@
import apiClient from "@/api/client";
import apiClient from '@/api/client';
export const getInquiriesApi = async () => {
const res = await apiClient.get("/inquiry/getAll");
const res = await apiClient.get('/inquiry/getAll');
return res.data;
};
+4 -6
View File
@@ -1,14 +1,12 @@
import apiClient from "@/api/client";
import apiClient from '@/api/client';
export const getNewsApi = async (page = 1, limit = 10, search = "") => {
const res = await apiClient.get(
`/newsMedia/getAll?page=${page}&limit=${limit}&search=${search}`,
);
export const getNewsApi = async (page = 1, limit = 10, search = '') => {
const res = await apiClient.get(`/newsMedia/getAll?page=${page}&limit=${limit}&search=${search}`);
return res.data;
};
export const createNewsApi = async (data: any) => {
const res = await apiClient.post("/newsMedia", data);
const res = await apiClient.post('/newsMedia', data);
return res.data;
};