omnivore/packages/web/lib/networking/mutations/deleteHighlightMutation.ts

29 lines
596 B
TypeScript
Raw Normal View History

2022-02-11 17:24:33 +00:00
import { gql } from 'graphql-request'
import { gqlFetcher } from '../networkHelpers'
export async function deleteHighlightMutation(
highlightId: string
): Promise<boolean> {
const mutation = gql`
mutation DeleteHighlight($highlightId: ID!) {
deleteHighlight(highlightId: $highlightId) {
... on DeleteHighlightSuccess {
highlight {
id
}
}
... on DeleteHighlightError {
errorCodes
}
}
}
`
try {
await gqlFetcher(mutation, { highlightId })
return true
} catch {
return false
}
}