bug fixes
This commit is contained in:
@@ -8,6 +8,7 @@ async function init() {
|
||||
try {
|
||||
const res = await fetch(`/api/book/${bookId}`);
|
||||
const data = await res.json();
|
||||
console.log(data)
|
||||
|
||||
if (data.error) {
|
||||
const titleEl = document.getElementById('title');
|
||||
|
||||
@@ -448,12 +448,16 @@ document.querySelectorAll('[data-direction]').forEach(btn => {
|
||||
});
|
||||
|
||||
prevBtn.addEventListener('click', () => {
|
||||
const newChapter = String(parseInt(chapter) - 1);
|
||||
const current = parseInt(chapter);
|
||||
if (current <= 0) return;
|
||||
|
||||
const newChapter = String(current - 1);
|
||||
updateURL(newChapter);
|
||||
window.scrollTo(0, 0);
|
||||
loadChapter();
|
||||
});
|
||||
|
||||
|
||||
nextBtn.addEventListener('click', () => {
|
||||
const newChapter = String(parseInt(chapter) + 1);
|
||||
updateURL(newChapter);
|
||||
|
||||
Reference in New Issue
Block a user