diff --git a/assets/vue/app/domain/setting/infrastructure/api/apiContentSourceRepository.js b/assets/vue/app/domain/setting/infrastructure/api/apiContentSourceRepository.js index 9739da8..f068008 100644 --- a/assets/vue/app/domain/setting/infrastructure/api/apiContentSourceRepository.js +++ b/assets/vue/app/domain/setting/infrastructure/api/apiContentSourceRepository.js @@ -81,4 +81,24 @@ export class ApiContentSourceRepository { throw new Error(error.response?.data?.message || 'Erreur lors de l\'import des sources'); } } + + /** + * Teste une configuration de scraper + */ + async testConfiguration(configuration) { + try { + const response = await this.apiClient.post('/scraping/test-configuration', configuration); + return response.data; + } catch (error) { + // Gestion spécifique des erreurs de validation + if (error.response?.status === 422) { + const validationErrors = error.response.data?.violations || []; + const errorMessage = validationErrors.map(violation => + `${violation.propertyPath}: ${violation.message}` + ).join(', ') || 'Erreur de validation'; + throw new Error(errorMessage); + } + throw new Error(error.response?.data?.message || 'Erreur lors du test de la configuration'); + } + } } diff --git a/assets/vue/app/domain/setting/presentation/components/ContentSourceForm.vue b/assets/vue/app/domain/setting/presentation/components/ContentSourceForm.vue index 21e4b3f..20568c3 100644 --- a/assets/vue/app/domain/setting/presentation/components/ContentSourceForm.vue +++ b/assets/vue/app/domain/setting/presentation/components/ContentSourceForm.vue @@ -152,12 +152,21 @@ + +
+
+ URL qui sera testée : +
{{ generatedTestUrl }}
+
+
+