Download wp-calypso/client/data/site-profiler/use-unsubscribe-query.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 517 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/site-profiler/use-unsubscribe-query.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/site-profiler/use-unsubscribe-query.ts
-
curl -L -o use-unsubscribe-query.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/site-profiler/use-unsubscribe-query.ts
517 Bytes
| import { useMutation } from '@tanstack/react-query'; | |
| import { LeadMutationResponse } from 'calypso/data/site-profiler/types'; | |
| import wp from 'calypso/lib/wp'; | |
| export const useUnsubscribeMutation = ( url?: string, hash?: string ) => { | |
| return useMutation( { | |
| mutationKey: [ 'email-unsubscribe', url, hash ], | |
| mutationFn: (): Promise< LeadMutationResponse > => | |
| wp.req.get( | |
| { | |
| path: '/site-profiler/emails/unsubscribe', | |
| apiNamespace: 'wpcom/v2', | |
| }, | |
| { | |
| url, | |
| hash, | |
| } | |
| ), | |
| } ); | |
| }; | |