You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
451 B
TypeScript

// 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() };
}