import { createCachedApi } from "./cacheService"; const api = createCachedApi("city"); export const getCity = async (id) => { const { data } = await api.get("/city/" + id); return data.payload; }; export const getCities = async () => { const { data } = await api.get("/city"); return data.payload; }; export const getCityByState = async (stateId) => { const { data } = await api.get(`/city/state/${stateId}`); return data.payload; }; export const getCityByCountry = async (countryId) => { const { data } = await api.get(`/city/country/${countryId}`); return data.payload; }; export const createCity = async (city) => { const { data } = await api.post("/city", city); return data.payload; }; export const updateCity = async (city, id) => { const { data } = await api.put(`/city/${id}`, city); return data.payload; }; export const deleteCity = async (id) => { const { data } = await api.del(`/city/${id}`); return data.payload; };