// frontend/lib/hooks/useJourney.ts — GET /api/journey (SWR)
"use client";
import useSWR from "swr";
import type { Journey } from "@/lib/types";
import { journeyApi } from "@/lib/journey/api";

export function useJourney() {
  const { data, error, isLoading, mutate } = useSWR<Journey>("journey", () => journeyApi.get(), {
    revalidateOnFocus: false,
    dedupingInterval: 5000,
  });
  return { data, error, isLoading, retry: () => mutate() };
}
