state.js 461 B

123456789101112131415161718
  1. import { createCachedApi } from "./cacheService";
  2. const api = createCachedApi("state");
  3. export const getState = async (id) => {
  4. const { data } = await api.get("/state/" + id);
  5. return data.payload;
  6. }
  7. export const getStates = async () => {
  8. const { data } = await api.get("/state");
  9. return data.payload;
  10. }
  11. export const getStateByCountry = async (countryId) => {
  12. const { data } = await api.get(`/state/country/${countryId}`);
  13. return data.payload;
  14. }