feat: route config pour les front

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-03-24 18:21:07 +01:00
parent 41dc3c51aa
commit ed0a075a6c
6 changed files with 29 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
--- ---
description: description:
globs: globs:
alwaysApply: true alwaysApply: false
--- ---
``` ```
Domain/Manga/Infrastructure/ApiPlatform/ Domain/Manga/Infrastructure/ApiPlatform/

View File

@@ -1,5 +1,5 @@
--- ---
description: need to create or find a job description:
globs: globs:
alwaysApply: false alwaysApply: false
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
description: description:
globs: globs:
alwaysApply: true alwaysApply: false
--- ---
# Tests de Mangarr # Tests de Mangarr

View File

@@ -1,17 +0,0 @@
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

@@ -37,11 +37,25 @@ export class ApiMangaRepository {
async getChapters(mangaId) { async getChapters(mangaId) {
try { try {
const response = await fetch(`/api/mangas/${mangaId}/chapters`); let allChapters = [];
let page = 1;
let hasMore = true;
while (hasMore) {
const response = await fetch(`/api/mangas/${mangaId}/chapters?limit=500&page=${page}`);
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to fetch manga chapters'); throw new Error('Failed to fetch manga chapters');
} }
return await response.json(); const data = await response.json();
allChapters = allChapters.concat(data.items);
hasMore = data.hasNextPage;
page++;
}
return {
items: allChapters,
total: allChapters.length
};
} catch (error) { } catch (error) {
console.error('API Error:', error); console.error('API Error:', error);
throw error; throw error;

View File

@@ -5,13 +5,19 @@ controllers:
type: attribute type: attribute
react_app: react_app:
path: /react path: /react/{req}
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
defaults: defaults:
template: 'react/index.html.twig' template: 'react/index.html.twig'
req: ''
requirements:
req: ".*"
vue_app: vue_app:
path: /vue path: /vue/{req}
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
defaults: defaults:
template: 'vue/index.html.twig' template: 'vue/index.html.twig'
req: ''
requirements:
req: ".*"