import { useDataContext } from "../contexts/data_context";
import { StateEntity } from '../domain/entities/state_entity';
import { useGet } from "./useGet"

export const useGetStates = () => {
    const { statesRepository } = useDataContext();

    const callback = async () =>{
        return await statesRepository?.getStates() || [];
    }
    const { requestStatus, data } = useGet<StateEntity[]>(callback);

    return { requestStatus, data };
}