| 123456789101112131415161718192021222324252627282930313233 |
- import { createCachedApi } from "./cacheService";
- const api = createCachedApi("state");
- export const getState = async (id) => {
- const { data } = await api.get("/state/" + id);
- return data.payload;
- }
- export const getStates = async () => {
- const { data } = await api.get("/state");
- return data.payload;
- }
- export const getStateByCountry = async (countryId) => {
- const { data } = await api.get(`/state/country/${countryId}`);
- return data.payload;
- }
- export const createState = async (state) => {
- const { data } = await api.post("/state", state);
- return data.payload;
- }
- export const updateState = async (state, id) => {
- const { data } = await api.put(`/state/${id}`, state);
- return data.payload;
- }
- export const deleteState = async (id) => {
- const { data } = await api.del(`/state/${id}`);
- return data.payload;
- }
|