Download wp-calypso/client/data/site-profiler/use-domain-analyzer-query.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 595 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/site-profiler/use-domain-analyzer-query.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/site-profiler/use-domain-analyzer-query.ts
-
curl -L -o use-domain-analyzer-query.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/site-profiler/use-domain-analyzer-query.ts
595 Bytes
| import { useQuery } from '@tanstack/react-query'; | |
| import { DomainAnalyzerQueryResponse } from 'calypso/data/site-profiler/types'; | |
| import wp from 'calypso/lib/wp'; | |
| export const useDomainAnalyzerQuery = ( domain: string, isValid?: boolean ) => { | |
| return useQuery( { | |
| queryKey: [ 'domain-', domain ], | |
| queryFn: (): Promise< DomainAnalyzerQueryResponse > => | |
| wp.req.get( { | |
| path: '/site-profiler/' + encodeURIComponent( domain ), | |
| apiNamespace: 'wpcom/v2', | |
| } ), | |
| meta: { | |
| persist: false, | |
| }, | |
| enabled: !! domain && isValid, | |
| retry: false, | |
| refetchOnWindowFocus: false, | |
| } ); | |
| }; | |