mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
34 lines
702 B
TypeScript
34 lines
702 B
TypeScript
|
|
import { gql } from 'graphql-request'
|
||
|
|
import { gqlFetcher } from '../networkHelpers'
|
||
|
|
|
||
|
|
type ShareHighlightToFeedMutationInput = {
|
||
|
|
id: string
|
||
|
|
share: boolean
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function shareHighlightToFeedMutation(
|
||
|
|
input: ShareHighlightToFeedMutationInput
|
||
|
|
): Promise<boolean> {
|
||
|
|
const mutation = gql`
|
||
|
|
mutation SetShareHighlight($input: SetShareHighlightInput!) {
|
||
|
|
setShareHighlight(input: $input) {
|
||
|
|
... on SetShareHighlightSuccess {
|
||
|
|
highlight {
|
||
|
|
id
|
||
|
|
}
|
||
|
|
}
|
||
|
|
... on SetShareHighlightError {
|
||
|
|
errorCodes
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
`
|
||
|
|
|
||
|
|
try {
|
||
|
|
await gqlFetcher(mutation, { input })
|
||
|
|
return true
|
||
|
|
} catch {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
}
|