Files
omnivore/packages/web/lib/networking/mutations/deleteDiscoverArticle.ts
Thomas Rogers c0373646cb Fix Linting...
2024-01-09 11:22:32 +01:00

35 lines
808 B
TypeScript

import { gql } from 'graphql-request'
import { gqlFetcher } from '../networkHelpers'
export type DeleteDiscoverArticleInput = {
discoverArticleId: string
}
export type DeleteDiscoverArticleOutput = {
deleteDiscoverArticle: { id: string }
}
export async function deleteDiscoverArticleMutation(
input: DeleteDiscoverArticleInput,
): Promise<DeleteDiscoverArticleOutput | undefined> {
const mutation = gql`
mutation DeleteDiscoverArticle($input: DeleteDiscoverArticleInput!) {
deleteDiscoverArticle(input: $input) {
... on DeleteDiscoverArticleSuccess {
id
}
... on DeleteDiscoverArticleError {
errorCodes
}
}
}
`
const data = (await gqlFetcher(mutation, {
input,
})) as DeleteDiscoverArticleOutput
return data
}