refactor next part
This commit is contained in:
16
src/lib/core/refactor/queryLoader.ts
Normal file
16
src/lib/core/refactor/queryLoader.ts
Normal 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 }));
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user