Skip to content

Commit

Permalink
Fix/chapter mark as unread not resetting last page read (#282)
Browse files Browse the repository at this point in the history
* [ChapterCard] Reset last page read to first page when changing chapters read status

The last page read was set to the second page instead of the first one

* [ChapterList] Reset last page read to first page when changing chapters read status

The "ChapterCard" and the "FAB" didn't have the same behaviour when marking a chapter as unread.
The "ChapterCard" also reset the last read page while the FAB only changed the read status.
  • Loading branch information
schroda authored Apr 12, 2023
1 parent 22b3437 commit c81189a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/manga/ChapterCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const ChapterCard: React.FC<IProps> = (props: IProps) => {
const formData = new FormData();
formData.append(key, value);
if (key === 'read') {
formData.append('lastPageRead', '1');
formData.append('lastPageRead', '0');
}
client
.patch(`/api/v1/manga/${chapter.mangaId}/chapter/${chapter.index}`, formData)
Expand Down
6 changes: 4 additions & 2 deletions src/components/manga/ChapterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ const ChapterList: React.FC<IProps> = ({ mangaId }) => {
if (action === 'delete') change.delete = true;
else if (action === 'bookmark') change.isBookmarked = true;
else if (action === 'unbookmark') change.isBookmarked = false;
else if (action === 'mark_as_read') change.isRead = true;
else if (action === 'mark_as_unread') change.isRead = false;
else if (action === 'mark_as_read' || action === 'mark_as_unread') {
change.isRead = action === 'mark_as_read';
change.lastPageRead = 0;
}

actionPromise = client.post('/api/v1/chapter/batch', { chapterIds, change });
}
Expand Down

0 comments on commit c81189a

Please sign in to comment.