mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 19:04:39 -05:00
prevPage handle
* go back to previous chapter on page 0 when prevPage is triggered
This commit is contained in:
@@ -139,6 +139,7 @@ export default function Reader() {
|
||||
}
|
||||
}, [curPage]);
|
||||
|
||||
// return spinner while chpater data is loading
|
||||
if (chapter.pageCount === -1) {
|
||||
return (
|
||||
<div className={classes.loading}>
|
||||
@@ -158,6 +159,12 @@ export default function Reader() {
|
||||
}
|
||||
};
|
||||
|
||||
const prevChapter = () => {
|
||||
if (chapter.index > 1) {
|
||||
history.push(`/manga/${manga.id}/chapter/${chapter.index - 1}`);
|
||||
}
|
||||
};
|
||||
|
||||
const pages = range(chapter.pageCount).map((index) => ({
|
||||
index,
|
||||
src: `${serverAddress}/api/v1/manga/${mangaId}/chapter/${chapterIndex}/page/${index}`,
|
||||
@@ -181,6 +188,7 @@ export default function Reader() {
|
||||
manga={manga}
|
||||
chapter={chapter}
|
||||
nextChapter={nextChapter}
|
||||
prevChapter={prevChapter}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user