17 lines
521 B
JavaScript
17 lines
521 B
JavaScript
export class MangaApi {
|
|
static async fetchById(mangaId) {
|
|
const response = await fetch(`/api/mangas/${mangaId}`);
|
|
if (!response.ok) {
|
|
throw new Error('Failed to fetch manga details');
|
|
}
|
|
return response.json();
|
|
}
|
|
|
|
static async fetchChapters(mangaId) {
|
|
const response = await fetch(`/api/mangas/${mangaId}/chapters`);
|
|
if (!response.ok) {
|
|
throw new Error('Failed to fetch manga chapters');
|
|
}
|
|
return response.json();
|
|
}
|
|
}
|