react-code-dataset / wp-calypso /client /sites /deployments /deployment-management /use-code-deployment-query.ts
react-code-dataset / wp-calypso /client /sites /deployments /deployment-management /use-code-deployment-query.ts
Download wp-calypso/client/sites/deployments/deployment-management/use-code-deployment-query.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 832 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/sites/deployments/deployment-management/use-code-deployment-query.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/sites/deployments/deployment-management/use-code-deployment-query.ts
-
curl -L -o use-code-deployment-query.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/sites/deployments/deployment-management/use-code-deployment-query.ts
832 Bytes
| import { useQuery, UseQueryOptions } from '@tanstack/react-query'; | |
| import wp from 'calypso/lib/wp'; | |
| import { GITHUB_DEPLOYMENTS_QUERY_KEY } from '../constants'; | |
| import { CodeDeploymentData } from '../deployments/use-code-deployments-query'; | |
| export const CODE_DEPLOYMENTS_QUERY_KEY = 'code-deployments'; | |
| export const useCodeDeploymentQuery = ( | |
| siteId: number | null, | |
| deploymentId: number, | |
| options?: UseQueryOptions< CodeDeploymentData > | |
| ) => { | |
| return useQuery< CodeDeploymentData >( { | |
| enabled: !! siteId, | |
| queryKey: [ GITHUB_DEPLOYMENTS_QUERY_KEY, CODE_DEPLOYMENTS_QUERY_KEY, siteId, deploymentId ], | |
| queryFn: (): CodeDeploymentData => | |
| wp.req.get( { | |
| path: `/sites/${ siteId }/hosting/code-deployments/${ deploymentId }`, | |
| apiNamespace: 'wpcom/v2', | |
| } ), | |
| meta: { | |
| persist: false, | |
| }, | |
| ...options, | |
| } ); | |
| }; | |