Download wp-calypso/client/data/sites/use-site-query.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 489 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/sites/use-site-query.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/sites/use-site-query.ts
-
curl -L -o use-site-query.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/sites/use-site-query.ts
489 Bytes
| import { getSiteQueryKey, SiteDetails } from '@automattic/data-stores'; | |
| import { useQuery } from '@tanstack/react-query'; | |
| import wp from 'calypso/lib/wp'; | |
| export const useSiteQuery = ( sourceSiteSlug: string, enabled = true ) => { | |
| return useQuery( { | |
| queryKey: getSiteQueryKey( sourceSiteSlug ), | |
| queryFn: (): Promise< SiteDetails > => | |
| wp.req.get( { | |
| path: '/sites/' + encodeURIComponent( sourceSiteSlug as string ), | |
| } ), | |
| meta: { | |
| persist: false, | |
| }, | |
| enabled, | |
| } ); | |
| }; | |