feat: ajout du lecteur de chapitres avec gestion des pages, des modes de lecture et des paramètres de zoom

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-03-26 22:52:48 +01:00
parent bf8ca79290
commit 85abca7906
10 changed files with 3500 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
import { ChapterRepositoryInterface } from '../../domain/repository/ChapterRepositoryInterface';
export class ApiChapterRepository extends ChapterRepositoryInterface {
async getChapter(chapterId) {
const response = await fetch(`/api/reader/chapter/${chapterId}`);
if (!response.ok) {
throw new Error('Failed to fetch chapter');
}
return response.json();
}
async getChapterPages(chapterId, page = 1, itemsPerPage = 20) {
const response = await fetch(
`/api/reader/chapter/${chapterId}/pages?page=${page}&itemsPerPage=${itemsPerPage}`
);
if (!response.ok) {
throw new Error('Failed to fetch chapter pages');
}
return response.json();
}
async getChapterPage(chapterId, pageNumber) {
const response = await fetch(`/api/reader/chapter/${chapterId}/page/${pageNumber}`);
if (!response.ok) {
throw new Error('Failed to fetch chapter page');
}
return response.json();
}
}