Download wp-calypso/client/data/plugins/use-update-schedules-capabilities-query.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 807 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/plugins/use-update-schedules-capabilities-query.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/plugins/use-update-schedules-capabilities-query.ts
-
curl -L -o use-update-schedules-capabilities-query.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/plugins/use-update-schedules-capabilities-query.ts
807 Bytes
| import { useQuery, UseQueryResult } from '@tanstack/react-query'; | |
| import wpcomRequest from 'wpcom-proxy-request'; | |
| import type { SiteSlug } from 'calypso/types'; | |
| export type ScheduleUpdatesCapabilities = { | |
| modify_files: boolean; | |
| autoupdate_files: boolean; | |
| errors?: { code: string; message: string }[]; | |
| }; | |
| export const useUpdateScheduleCapabilitiesQuery = ( | |
| siteSlug: SiteSlug, | |
| isEligibleForFeature: boolean | |
| ): UseQueryResult< ScheduleUpdatesCapabilities > => { | |
| return useQuery( { | |
| queryKey: [ 'schedule-updates-capabilities', siteSlug ], | |
| queryFn: () => | |
| wpcomRequest( { | |
| path: `/sites/${ siteSlug }/update-schedules/capabilities`, | |
| apiNamespace: 'wpcom/v2', | |
| method: 'GET', | |
| } ), | |
| enabled: !! siteSlug && isEligibleForFeature, | |
| retry: false, | |
| refetchOnWindowFocus: false, | |
| } ); | |
| }; | |