2022-02-11 17:24:33 +00:00
|
|
|
import { gql } from 'graphql-request'
|
|
|
|
|
import { gqlFetcher } from '../networkHelpers'
|
|
|
|
|
|
2022-03-22 20:58:19 +00:00
|
|
|
export type ArticleReadingProgressMutationInput = {
|
2022-02-11 17:24:33 +00:00
|
|
|
id: string
|
2023-10-24 09:15:03 +00:00
|
|
|
force?: boolean
|
2023-03-10 06:50:45 +00:00
|
|
|
readingProgressPercent?: number
|
2023-03-10 07:05:03 +00:00
|
|
|
readingProgressTopPercent?: number
|
2023-03-10 06:50:45 +00:00
|
|
|
readingProgressAnchorIndex?: number
|
2022-02-11 17:24:33 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-29 13:27:49 +00:00
|
|
|
// export async function articleReadingProgressMutation(
|
|
|
|
|
// input: ArticleReadingProgressMutationInput
|
|
|
|
|
// ): Promise<boolean> {
|
|
|
|
|
// const mutation = gql`
|
|
|
|
|
// mutation SaveArticleReadingProgress(
|
|
|
|
|
// $input: SaveArticleReadingProgressInput!
|
|
|
|
|
// ) {
|
|
|
|
|
// saveArticleReadingProgress(input: $input) {
|
|
|
|
|
// ... on SaveArticleReadingProgressSuccess {
|
|
|
|
|
// updatedArticle {
|
|
|
|
|
// id
|
|
|
|
|
// readingProgressPercent
|
|
|
|
|
// readingProgressAnchorIndex
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// ... on SaveArticleReadingProgressError {
|
|
|
|
|
// errorCodes
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// `
|
2022-02-11 17:24:33 +00:00
|
|
|
|
2024-07-29 13:27:49 +00:00
|
|
|
// try {
|
|
|
|
|
// await gqlFetcher(mutation, { input })
|
|
|
|
|
// return true
|
|
|
|
|
// } catch {
|
|
|
|
|
// return false
|
|
|
|
|
// }
|
|
|
|
|
// }
|