import { useDataContext } from "../../common/contexts/data_context";
import { useGet } from "../../common/hooks/useGet";
import { ActivityInfoEntity } from "../domain/entities/activity_info_entity";


export const useGetActivities = (townId: number) => {
    const { statesRepository } = useDataContext();
    const callback = async () =>{
        return await statesRepository?.getTownActivities(townId) || [];
    }
    const { data, requestStatus } = useGet<ActivityInfoEntity[]>(callback);
    return { activities: data, requestStatus };
}