react-code-dataset / wp-calypso /client /landing /stepper /hooks /use-install-wpcom-migration-plugin.ts
react-code-dataset / wp-calypso /client /landing /stepper /hooks /use-install-wpcom-migration-plugin.ts
Download wp-calypso/client/landing/stepper/hooks/use-install-wpcom-migration-plugin.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 821 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/landing/stepper/hooks/use-install-wpcom-migration-plugin.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/landing/stepper/hooks/use-install-wpcom-migration-plugin.ts
-
curl -L -o use-install-wpcom-migration-plugin.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/landing/stepper/hooks/use-install-wpcom-migration-plugin.ts
821 Bytes
| import { useMutation } from '@tanstack/react-query'; | |
| import wpcom from 'calypso/lib/wp'; | |
| export const useInstallWPCOMMigrationPlugin = ( siteId: number ) => { | |
| return useMutation< Response, Error >( { | |
| mutationKey: [ 'install-wpcom-migration-plugin', siteId ], | |
| mutationFn: () => { | |
| return wpcom.req.post( { | |
| path: `/sites/${ siteId }/plugins/wpcom-migration/install`, | |
| apiNamespace: 'rest/v1.2', | |
| } ); | |
| }, | |
| } ); | |
| }; | |
| export const useActivateWPCOMMigrationPlugin = ( siteId: number ) => { | |
| return useMutation< Response, Error >( { | |
| mutationKey: [ 'activate-wpcom-migration-plugin', siteId ], | |
| mutationFn: () => { | |
| return wpcom.req.post( { | |
| path: `/sites/${ siteId }/plugins/wpcom-migration%2fwpcom_migration`, | |
| apiNamespace: 'rest/v1.2', | |
| body: { | |
| active: true, | |
| }, | |
| } ); | |
| }, | |
| } ); | |
| }; | |