refactor next part

This commit is contained in:
Samuel Andert
2023-08-04 17:57:22 +02:00
parent 8214792f01
commit 39ceac9582
2 changed files with 14 additions and 22 deletions

View File

@ -0,0 +1,16 @@
// dataLoader.ts
import { writable } from 'svelte/store';
import dataSources from 'virtual:data-sources-list';
// The store that holds the data sets
export const queryStore = writable({});
// Dynamically import the data modules and assign them to the store
dataSources.forEach(src => {
import(`/src/lib/data/${src}.ts`).then(module => {
// Here, explicitly extract the required data or function from the module
const moduleData = module[src] || module.default;
queryStore.update(store => ({ ...store, [src]: moduleData }));
});
});