[crawler_platform 삭제]
This commit is contained in:
21
ontology_platform/web/frontend/src/hooks/useDomains.ts
Normal file
21
ontology_platform/web/frontend/src/hooks/useDomains.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { domainsApi, DomainSummary } from "@/lib/api/domains";
|
||||
import { ontologyApi, OntologyDetail } from "@/lib/api/ontology";
|
||||
import { queryKeys } from "./queryKeys";
|
||||
|
||||
export function useDomains() {
|
||||
return useQuery<DomainSummary[]>({
|
||||
queryKey: queryKeys.domains.list(),
|
||||
queryFn: () => domainsApi.list(),
|
||||
staleTime: 1000 * 60 * 30,
|
||||
});
|
||||
}
|
||||
|
||||
export function useOntology(domain: string | undefined) {
|
||||
return useQuery<OntologyDetail>({
|
||||
queryKey: queryKeys.ontology.byDomain(domain ?? ""),
|
||||
queryFn: () => ontologyApi.get(domain!),
|
||||
enabled: Boolean(domain),
|
||||
staleTime: 1000 * 60 * 30,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user