Fix/chapter mark as unread not resetting last page read (#282)

* [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.
This commit is contained in:
schroda
2023-04-12 18:37:23 +02:00
committed by GitHub
parent 22b3437dcd
commit c81189a9ed
2 changed files with 5 additions and 3 deletions

View File

@@ -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)

View File

@@ -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 });
}