Download wp-calypso/packages/help-center/src/data/use-submit-support-ticket.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/packages/help-center/src/data/use-submit-support-ticket.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/help-center/src/data/use-submit-support-ticket.ts
-
curl -L -o use-submit-support-ticket.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/help-center/src/data/use-submit-support-ticket.ts
821 Bytes
| import { useMutation } from '@tanstack/react-query'; | |
| import apiFetch, { APIFetchOptions } from '@wordpress/api-fetch'; | |
| import wpcomRequest, { canAccessWpcomApis } from 'wpcom-proxy-request'; | |
| type Ticket = { | |
| subject: string; | |
| message: string; | |
| locale: string; | |
| client: string; | |
| is_chat_overflow: boolean; | |
| source: string; | |
| blog_url: string; | |
| ai_chat_id?: string; | |
| ai_message?: string; | |
| }; | |
| export function useSubmitTicketMutation() { | |
| return useMutation( { | |
| mutationFn: ( newTicket: Ticket ) => | |
| canAccessWpcomApis() | |
| ? wpcomRequest( { | |
| path: '/help/ticket/new', | |
| apiNamespace: 'wpcom/v2', | |
| method: 'POST', | |
| body: newTicket, | |
| } ) | |
| : apiFetch( { | |
| global: true, | |
| path: '/help-center/ticket/new', | |
| method: 'POST', | |
| data: newTicket, | |
| } as APIFetchOptions ), | |
| } ); | |
| } | |