Download wp-calypso/client/data/emails/use-create-titan-mailbox-mutation.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 801 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/emails/use-create-titan-mailbox-mutation.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/emails/use-create-titan-mailbox-mutation.ts
-
curl -L -o use-create-titan-mailbox-mutation.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/emails/use-create-titan-mailbox-mutation.ts
801 Bytes
| import { useMutation } from '@tanstack/react-query'; | |
| import wpcom from 'calypso/lib/wp'; | |
| import type { TitanMailboxFields } from 'calypso/my-sites/email/form/mailboxes/constants'; | |
| /** | |
| * Creates a mailbox for a Professional Email (Titan) account | |
| * @returns Returns the result of the `useMutation` call | |
| */ | |
| export const useCreateTitanMailboxMutation = () => { | |
| return useMutation< unknown, unknown, TitanMailboxFields >( { | |
| mutationFn: ( { domain, isAdmin, mailbox, name, password, passwordResetEmail } ) => { | |
| return wpcom.req.post( { | |
| path: `/emails/titan/${ encodeURIComponent( domain ) }/mailbox/create`, | |
| apiNamespace: 'wpcom/v2', | |
| body: { | |
| name, | |
| mailbox, | |
| password, | |
| alternate_email_address: passwordResetEmail, | |
| is_admin: isAdmin, | |
| }, | |
| } ); | |
| }, | |
| } ); | |
| }; | |