20 lines
628 B
TypeScript
20 lines
628 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { useSettingsStore } from "@/store/settings.store";
|
|
import { getSearchCapabilities } from "../api/search.api";
|
|
import type { SearchScope } from "../types/search.types";
|
|
|
|
export function useSearchCapabilities(scope?: SearchScope) {
|
|
const preview = useSettingsStore((state) => state.contentPreviewEnabled);
|
|
return useQuery({
|
|
queryKey: [
|
|
"search",
|
|
"capabilities",
|
|
scope?.module_codes ?? null,
|
|
scope?.content_kinds ?? null,
|
|
preview,
|
|
],
|
|
queryFn: () => getSearchCapabilities(scope, preview),
|
|
staleTime: 30 * 60 * 1000,
|
|
});
|
|
}
|