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

29 lines
698 B
TypeScript

import { gql } from 'graphql-request'
import { gqlFetcher } from '../networkHelpers'
export async function deleteLinkMutation(
linkId: string
): Promise<unknown> {
const mutation = gql`
mutation SetBookmarkArticle($input: SetBookmarkArticleInput!) {
setBookmarkArticle(input: $input) {
... on SetBookmarkArticleSuccess {
bookmarkedArticle {
id
}
}
... on SetBookmarkArticleError {
errorCodes
}
}
}`
try {
const data = await gqlFetcher(mutation, { input: { articleID: linkId, bookmark: false }})
return data
} catch (error) {
console.log('SetBookmarkArticleOutput error', error)
return undefined
}
}