File size: 821 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 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,
},
} );
},
} );
};
|