feat: ajout de la gestion des sources préférées pour les mangas, incluant la récupération et la configuration des sources via l'API, ainsi que l'intégration d'une modale pour l'interface utilisateur.
This commit is contained in:
parent
15d92d1aff
commit
75f8e1686c
@@ -141,4 +141,36 @@ export class ApiMangaRepository {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async getPreferredSources(mangaId) {
|
||||
try {
|
||||
const response = await fetch(`/api/mangas/${mangaId}/preferred-sources`);
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch preferred sources');
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('API Error:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async setPreferredSources(mangaId, sourceIds) {
|
||||
try {
|
||||
const response = await fetch(`/api/mangas/${mangaId}/preferred-sources`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ sourceIds })
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to set preferred sources');
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('API Error:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user