feat: page MangaDetails en vue.js

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-03-24 18:01:24 +01:00
parent bee8572dc5
commit 41dc3c51aa
10 changed files with 477 additions and 135 deletions

View File

@@ -0,0 +1,17 @@
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();
}
}

View File

@@ -22,6 +22,32 @@ export class ApiMangaRepository {
}
}
async getMangaById(id) {
try {
const response = await fetch(`/api/mangas/${id}`);
if (!response.ok) {
throw new Error('Failed to fetch manga details');
}
return await response.json();
} catch (error) {
console.error('API Error:', error);
throw error;
}
}
async getChapters(mangaId) {
try {
const response = await fetch(`/api/mangas/${mangaId}/chapters`);
if (!response.ok) {
throw new Error('Failed to fetch manga chapters');
}
return await response.json();
} catch (error) {
console.error('API Error:', error);
throw error;
}
}
async getMangaBySlug(slug) {
try {
const response = await fetch(`/api/mangas/${slug}`);