fix wrong chapter count, abstract next page

This commit is contained in:
Aria Moradi
2021-05-18 01:10:28 +04:30
parent c0b49c7428
commit 49dc9fe5f6
5 changed files with 15 additions and 8 deletions
@@ -24,7 +24,7 @@ const useStyles = makeStyles({
export default function PagedReader(props: IReaderProps) {
const {
pages, settings, setCurPage, curPage, manga, chapter,
pages, settings, setCurPage, curPage, manga, chapter, nextChapter,
} = props;
const classes = useStyles();
@@ -36,7 +36,7 @@ export default function PagedReader(props: IReaderProps) {
if (curPage < pages.length - 1) {
setCurPage(curPage + 1);
} else if (settings.loadNextonEnding) {
history.push(`/manga/${manga.id}/chapter/${chapter.index + 1}`);
nextChapter();
}
}
@@ -23,7 +23,7 @@ const useStyles = makeStyles({
export default function VerticalReader(props: IReaderProps) {
const {
pages, settings, setCurPage, curPage, manga, chapter,
pages, settings, setCurPage, curPage, manga, chapter, nextChapter,
} = props;
const classes = useStyles();
@@ -31,8 +31,7 @@ export default function VerticalReader(props: IReaderProps) {
const handleLoadNextonEnding = () => {
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
setCurPage(0);
history.push(`/manga/${manga.id}/chapter/${chapter.index + 1}`);
nextChapter();
}
};
useEffect(() => {