import { useDataContext } from "../../common/contexts/data_context";
import { useGet } from "../../common/hooks/useGet";

export const useGetRoute = (routeId: number) => {
  const { routeRepository } = useDataContext();
  const callback = () => {
    return routeRepository!.getRoute(routeId);
  };
  const { data: route, requestStatus, refresh } = useGet(callback);
  return { route, requestStatus, refresh };
};
