import { MapSourceFormValues } from "../schemas/map-source"; import { PaginatedResponse } from "../types/api-response"; import { MapSource } from "../types/map-source"; import { apiHelpers } from "./api"; const mapSourceApi = { getMapSources: async (params?: { filter?: string | string[]; limit?: number; offset?: number; sort?: string; }): Promise> => { const filteredParams = { ...params }; if (!filteredParams.sort) { delete filteredParams.sort; } return apiHelpers.get("/map_sources", { params: filteredParams, paramsSerializer: { indexes: null, // This allows multiple params with the same name }, }); }, getMapSourceById: async (id: string): Promise => { return apiHelpers.get(`/map_sources/${id}`); }, deleteMapSource: async (id?: string): Promise => { return apiHelpers.delete(`/map_sources/${id}`); }, createMapSource: async ( mapsSource: Omit ): Promise => { return apiHelpers.post("/map_sources", mapsSource); }, updateMapSource: async ( id: string, mapsSource: Partial ): Promise => { return apiHelpers.patch(`/map_sources/${id}`, mapsSource); }, }; export default mapSourceApi;