pse2_ff/project/frontend/src/util/query.ts

21 lines
559 B
TypeScript

import { queryOptions } from "@tanstack/react-query";
import { fetchKPI, fetchKennzahlen, fetchPitchBooks } from "./api";
export const kpiQueryOptions = (pitchBookId: string) =>
queryOptions({
queryKey: ["pitchBookKPI", pitchBookId],
queryFn: () => fetchKPI(pitchBookId),
});
export const settingsQueryOptions = () =>
queryOptions({
queryKey: ["pitchBookSettings"],
queryFn: () => fetchKennzahlen(),
});
export const pitchBooksQueryOptions = () =>
queryOptions({
queryKey: ["pitchBooks"],
queryFn: fetchPitchBooks,
staleTime: 30000,
});