diff options
Diffstat (limited to 'src/services/graphql/contact.ts')
| -rw-r--r-- | src/services/graphql/contact.ts | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/services/graphql/contact.ts b/src/services/graphql/contact.ts deleted file mode 100644 index 4699688..0000000 --- a/src/services/graphql/contact.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { SendMailReturn, SentEmailResponse } from '@ts/types/contact'; -import { gql } from 'graphql-request'; -import { getGraphQLClient } from './client'; - -export const sendMail: SendMailReturn = async ( - subject: string, - body: string, - replyTo: string, - mutationId: string -) => { - const client = getGraphQLClient(); - const mutation = gql` - mutation SendEmail( - $subject: String! - $body: String! - $replyTo: String! - $mutationId: String! - ) { - sendEmail( - input: { - clientMutationId: $mutationId - body: $body - replyTo: $replyTo - subject: $subject - } - ) { - clientMutationId - message - sent - origin - replyTo - to - } - } - `; - - const variables = { subject, body, replyTo, mutationId }; - - try { - const response: SentEmailResponse = await client.request( - mutation, - variables - ); - return response.sendEmail; - } catch (error) { - console.error(error, undefined, 2); - process.exit(1); - } -}; |
