feat: ajout d'une route GetMangaByIdHandler.php et fix de la SearchBar.vue
This commit is contained in:
parent
ed0a075a6c
commit
d9e935f7de
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ApiMangaRepository } from '../../infrastructure/api/apiMangaRepository';
|
||||
import {defineStore} from 'pinia';
|
||||
import {ApiMangaRepository} from '../../infrastructure/api/apiMangaRepository';
|
||||
|
||||
const mangaRepository = new ApiMangaRepository();
|
||||
|
||||
@@ -19,32 +19,26 @@ export const useMangaStore = defineStore('manga', {
|
||||
// Actions pour la collection
|
||||
async loadCollection() {
|
||||
if (this.loading) return;
|
||||
|
||||
console.log('Starting loadCollection...');
|
||||
|
||||
this.loading = true;
|
||||
this.error = null;
|
||||
|
||||
|
||||
try {
|
||||
console.log('Fetching collection from repository...');
|
||||
this.collection = await mangaRepository.getCollection();
|
||||
console.log('Collection loaded:', this.collection);
|
||||
} catch (err) {
|
||||
this.error = err.message;
|
||||
console.error('Failed to load collection:', err);
|
||||
} finally {
|
||||
this.loading = false;
|
||||
console.log('loadCollection finished. Loading:', this.loading);
|
||||
}
|
||||
},
|
||||
|
||||
async refreshCollectionInBackground() {
|
||||
if (this.isBackgroundLoading) return;
|
||||
|
||||
|
||||
this.isBackgroundLoading = true;
|
||||
|
||||
|
||||
try {
|
||||
const updatedCollection = await mangaRepository.getCollection();
|
||||
this.collection = updatedCollection;
|
||||
this.collection = await mangaRepository.getCollection();
|
||||
} catch (err) {
|
||||
console.error('Failed to refresh collection:', err);
|
||||
} finally {
|
||||
@@ -70,12 +64,10 @@ export const useMangaStore = defineStore('manga', {
|
||||
this.error = null;
|
||||
try {
|
||||
const response = await mangaRepository.getChapters(mangaId);
|
||||
console.log('API Response:', response); // Pour déboguer
|
||||
this.chapters = Array.isArray(response) ? response :
|
||||
this.chapters = Array.isArray(response) ? response :
|
||||
(response.items ? response.items : []);
|
||||
} catch (error) {
|
||||
this.error = error.message;
|
||||
console.error('Failed to fetch chapters:', error);
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
@@ -86,4 +78,4 @@ export const useMangaStore = defineStore('manga', {
|
||||
this.chapters = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user