feat: ajout de la recherche de chapitres dans le store Manga et mise à jour de l'API pour récupérer les chapitres, ainsi que des ajustements dans la configuration de Tailwind et la suppression de l'entrée React dans Webpack.
This commit is contained in:
parent
b187f3e153
commit
e51712a800
@@ -1,4 +1,3 @@
|
||||
import { registerReactControllerComponents } from '@symfony/ux-react';
|
||||
import './bootstrap.js';
|
||||
|
||||
import '@fortawesome/fontawesome-free/js/all.js';
|
||||
@@ -15,4 +14,4 @@ import './styles/app.scss';
|
||||
// start the Stimulus application
|
||||
import './bootstrap';
|
||||
|
||||
//registerReactControllerComponents(require.context('./react/controllers', true, /\.(j|t)sx?$/));
|
||||
// La ligne registerReactControllerComponents a déjà été commentée
|
||||
|
||||
@@ -128,6 +128,19 @@ export const useMangaStore = defineStore('manga', {
|
||||
} finally {
|
||||
this.addingManga = false;
|
||||
}
|
||||
},
|
||||
|
||||
// --- Chapter Actions ---
|
||||
async searchChapter(chapterId) {
|
||||
try {
|
||||
await mangaRepository.searchChapter(chapterId);
|
||||
// Rafraîchir la collection après la recherche
|
||||
await this.refreshCollectionInBackground();
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la recherche du chapitre:', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -119,4 +119,23 @@ export class ApiMangaRepository {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async searchChapter(chapterId) {
|
||||
try {
|
||||
const response = await fetch('https://localhost/api/scraping/chapters', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ chapterId })
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error('Échec de la recherche du chapitre');
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('API Error:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,11 @@
|
||||
const store = useMangaStore();
|
||||
|
||||
const handleSearch = async () => {
|
||||
// TODO: Implémenter la recherche de chapitre
|
||||
console.log('Recherche du chapitre:', props.chapter.id);
|
||||
try {
|
||||
await store.searchChapter(props.chapter.id);
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la recherche du chapitre:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = async () => {
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
<template>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 p-6">
|
||||
<MangaCard
|
||||
v-for="manga in mangas"
|
||||
:key="manga.id"
|
||||
:manga="manga"
|
||||
/>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 p-6">
|
||||
<MangaCard v-for="manga in mangas" :key="manga.id" :manga="manga" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import MangaCard from './MangaCard.vue';
|
||||
import MangaCard from './MangaCard.vue';
|
||||
|
||||
defineProps({
|
||||
mangas: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
</script>
|
||||
defineProps({
|
||||
mangas: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user