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("/selects/states");
  return data.payload;
}

export const getStateByCountry = async (countryId) => {
  const { data } = await api.get("/selects/states", { params: { country_id: countryId } });
  return data.payload;
}
