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

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

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

    return { requestStatus, data, refresh };
}