Skip to content

Commit

Permalink
fix trackProgress while reading
Browse files Browse the repository at this point in the history
  • Loading branch information
Robonau authored and Robonau committed May 19, 2024
1 parent e6a09b8 commit 7631b52
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/routes/(app)/manga/[MangaID]/chapter/[ChapterID]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -392,19 +392,21 @@
}
];
if (!updatedChaps.includes(selector)) {
client
.mutation(updateChapter, {
id,
lastPageRead: pageIndex,
isRead: pageIndex >= maxPages * 0.8 ? true : null
})
.toPromise()
.then(() => {
if ($manga.data?.manga?.id)
client.mutation(trackProgress, {
mangaId: $manga.data?.manga?.id
});
});
async () => {
await client
.mutation(updateChapter, {
id,
lastPageRead: pageIndex,
isRead: pageIndex >= maxPages * 0.8 ? true : null
})
.toPromise();
if (!$manga.data?.manga?.id || pageIndex !== maxPages - 1) return;
await client
.mutation(trackProgress, {
mangaId: $manga.data?.manga?.id
})
.toPromise();
};
updatedChaps.push(selector);
setTimeout(() => {
updatedChaps = updatedChaps.filter((e) => e !== selector);
Expand Down

0 comments on commit 7631b52

Please sign in to comment.