react-code-dataset / wp-calypso /client /data /domains /diagnostics /use-domain-diagnostics-query.ts
react-code-dataset / wp-calypso /client /data /domains /diagnostics /use-domain-diagnostics-query.ts
Download wp-calypso/client/data/domains/diagnostics/use-domain-diagnostics-query.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 641 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/domains/diagnostics/use-domain-diagnostics-query.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/domains/diagnostics/use-domain-diagnostics-query.ts
-
curl -L -o use-domain-diagnostics-query.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/domains/diagnostics/use-domain-diagnostics-query.ts
641 Bytes
| import { UseQueryResult, useQuery } from '@tanstack/react-query'; | |
| import { DomainDiagnostics } from 'calypso/lib/domains/types'; | |
| import wp from 'calypso/lib/wp'; | |
| import { domainDiagnosticsQueryKey } from './domain-diagnostics-query-key'; | |
| export default function useDomainDiagnosticsQuery( | |
| domainName: string, | |
| queryOptions = {} | |
| ): UseQueryResult< DomainDiagnostics > { | |
| return useQuery( { | |
| queryKey: domainDiagnosticsQueryKey( domainName ), | |
| queryFn: () => | |
| wp.req.get( { | |
| path: `/domains/diagnostics/${ domainName }`, | |
| apiNamespace: 'wpcom/v2', | |
| } ), | |
| refetchOnWindowFocus: false, | |
| enabled: true, | |
| ...queryOptions, | |
| } ); | |
| } | |