Download wp-calypso/packages/help-center/src/data/use-user-sites.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 588 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/help-center/src/data/use-user-sites.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/help-center/src/data/use-user-sites.ts
-
curl -L -o use-user-sites.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/help-center/src/data/use-user-sites.ts
588 Bytes
| import { useQuery } from '@tanstack/react-query'; | |
| import wpcomRequest from 'wpcom-proxy-request'; | |
| import type { SiteDetails } from '@automattic/data-stores'; | |
| // Bump this version to invalidate the cache. | |
| const VERSION = 2; | |
| export function useUserSites( userId: number | string, enabled = true ) { | |
| return useQuery( { | |
| queryKey: [ 'user-sites', userId, VERSION ], | |
| queryFn: () => | |
| wpcomRequest< { sites: SiteDetails[] } >( { | |
| path: '/me/sites/?include_domain_only=true', | |
| apiVersion: '1.2', | |
| } ), | |
| refetchOnWindowFocus: false, | |
| staleTime: 5 * 60 * 1000, | |
| enabled, | |
| } ); | |
| } | |