feat: ajout de la gestion des sources de contenu avec création de composants, formulaires et API pour l'importation, l'exportation et la configuration des sources de scraping.
This commit is contained in:
parent
32b4e4fbb2
commit
dac2f91998
@@ -0,0 +1,56 @@
|
||||
import { computed } from 'vue';
|
||||
import { useContentSourceStore } from '../../application/store/contentSourceStore';
|
||||
|
||||
export function useContentSources() {
|
||||
const store = useContentSourceStore();
|
||||
|
||||
// Computed properties pour un accès facile aux données
|
||||
const sources = computed(() => store.sources);
|
||||
const currentSource = computed(() => store.currentSource);
|
||||
const isLoading = computed(() => store.loadingSources || store.loadingCurrentSource);
|
||||
const isSaving = computed(() => store.saving);
|
||||
const hasError = computed(() => store.sourcesError || store.currentSourceError || store.saveError);
|
||||
|
||||
// Getters
|
||||
const getSourceById = (id) => store.getSourceById(id);
|
||||
const getSourcesByType = (type) => store.getSourcesByType(type);
|
||||
const htmlSources = computed(() => store.htmlSources);
|
||||
const javascriptSources = computed(() => store.javascriptSources);
|
||||
|
||||
// Actions
|
||||
const loadSources = () => store.loadSources();
|
||||
const loadSource = (id) => store.loadSource(id);
|
||||
const createSource = (data) => store.createSource(data);
|
||||
const updateSource = (id, data) => store.updateSource(id, data);
|
||||
const exportSources = () => store.exportSources();
|
||||
const importSources = (data) => store.importSources(data);
|
||||
const clearCurrentSource = () => store.clearCurrentSource();
|
||||
const clearErrors = () => store.clearErrors();
|
||||
|
||||
return {
|
||||
// Data
|
||||
sources,
|
||||
currentSource,
|
||||
|
||||
// States
|
||||
isLoading,
|
||||
isSaving,
|
||||
hasError,
|
||||
|
||||
// Getters
|
||||
getSourceById,
|
||||
getSourcesByType,
|
||||
htmlSources,
|
||||
javascriptSources,
|
||||
|
||||
// Actions
|
||||
loadSources,
|
||||
loadSource,
|
||||
createSource,
|
||||
updateSource,
|
||||
exportSources,
|
||||
importSources,
|
||||
clearCurrentSource,
|
||||
clearErrors
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user