import axiosInstance from "./axiosInstance"; export interface IndexResponse { count: number; page_size: number; page: number; total_pages: number; results: IndexType[]; } export interface IndexType { id: number; school_index: string; } export const getIndexes = async ( page?: number, search?:string ) => { const res = await axiosInstance.get("/api/admin/schools", { params: { page, search }, }); return res.data; }; export const getIndexById = async (id: number) => { const res = await axiosInstance.get(`/api/admin/schools/${id}`); return res.data; }; export const createIndex = async (name: string) => { const res = await axiosInstance.post(`/api/admin/schools/`, { school_index: name }); return res.data; }; export const updateIndex = async (id: number, name: string) => { const res = await axiosInstance.put(`/api/admin/schools/${id}`, { school_index: name }); return res.data; }; export const deleteIndex = async (id: number) => { const res = await axiosInstance.delete(`/api/admin/schools/${id}`); return res.data; };