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