Spaces:
Configuration error
Configuration error
Download frontend/src/hooks/query/use-get-traces.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 668 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/hooks/query/use-get-traces.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/hooks/query/use-get-traces.ts
-
curl -L -o use-get-traces.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/hooks/query/use-get-traces.ts
668 Bytes
| import { useQuery } from "@tanstack/react-query"; | |
| import React from "react"; | |
| import InvariantService from "#/api/invariant-service"; | |
| type ResponseData = object; | |
| interface UseGetTracesConfig { | |
| onSuccess: (data: ResponseData) => void; | |
| } | |
| export const useGetTraces = (config?: UseGetTracesConfig) => { | |
| const data = useQuery({ | |
| queryKey: ["traces"], | |
| queryFn: InvariantService.getTraces, | |
| enabled: false, | |
| }); | |
| const { isFetching, isSuccess, data: traces } = data; | |
| React.useEffect(() => { | |
| if (!isFetching && isSuccess && traces) { | |
| config?.onSuccess(traces); | |
| } | |
| }, [isFetching, isSuccess, traces, config?.onSuccess]); | |
| return data; | |
| }; | |