16 lines
604 B
TypeScript
16 lines
604 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { contentPresentationApi } from "../api/content-presentation.client";
|
|
import { contentPresentationQueryKeys } from "../api/content-presentation.query-keys";
|
|
|
|
export function useModuleSearchContractQuery(moduleCode?: string | null) {
|
|
const code = moduleCode?.trim() ?? "";
|
|
return useQuery({
|
|
queryKey: contentPresentationQueryKeys.moduleSearchContract(code),
|
|
queryFn: () => contentPresentationApi.getModuleSearchContract(code),
|
|
enabled: Boolean(code),
|
|
staleTime: 30 * 60 * 1000,
|
|
gcTime: 60 * 60 * 1000,
|
|
retry: 2,
|
|
});
|
|
}
|