Files
omnivore/packages/web/lib/networking/mutations/updateShareHighlightCommentMutation.ts
2022-02-11 09:24:33 -08:00

35 lines
710 B
TypeScript

import { gql } from 'graphql-request'
import { gqlFetcher } from '../networkHelpers'
type ShareHighlightCommentMutationInput = {
highlightId: string
annotation?: string
}
export async function shareHighlightCommentMutation(
input: ShareHighlightCommentMutationInput
): Promise<boolean> {
const mutation = gql`
mutation UpdateHighlight($input: UpdateHighlightInput!) {
updateHighlight(input: $input) {
... on UpdateHighlightSuccess {
highlight {
id
}
}
... on UpdateHighlightError {
errorCodes
}
}
}
`
try {
await gqlFetcher(mutation, { input })
return true
} catch {
return false
}
}