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

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 };
}