diff options
Diffstat (limited to 'src/services/graphql/comments.ts')
| -rw-r--r-- | src/services/graphql/comments.ts | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/services/graphql/comments.ts b/src/services/graphql/comments.ts deleted file mode 100644 index b7a9ed2..0000000 --- a/src/services/graphql/comments.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - CreatedCommentResponse, - CreatedCommentReturn, -} from '@ts/types/comments'; -import { gql } from 'graphql-request'; -import { getGraphQLClient } from './client'; - -export const createComment: CreatedCommentReturn = async ( - author: string, - authorEmail: string, - authorUrl: string, - content: string, - parent: number, - commentOn: number, - mutationId: string -) => { - const client = getGraphQLClient(); - const mutation = gql` - mutation CreateComment( - $author: String! - $authorEmail: String! - $authorUrl: String! - $content: String! - $parent: ID! - $commentOn: Int! - $mutationId: String! - ) { - createComment( - input: { - author: $author - authorEmail: $authorEmail - authorUrl: $authorUrl - content: $content - parent: $parent - commentOn: $commentOn - clientMutationId: $mutationId - } - ) { - clientMutationId - success - comment { - approved - } - } - } - `; - - const variables = { - author, - authorEmail, - authorUrl, - content, - parent, - commentOn, - mutationId, - }; - - try { - const response: CreatedCommentResponse = await client.request( - mutation, - variables - ); - return response.createComment; - } catch (error) { - console.error(error, undefined, 2); - throw new Error(`An uncaught exception has occurred: ${error}`); - } -}; |
