Further cleanup and fixing Wallet and GoogleAuth to the new Composer interface

This commit is contained in:
Samuel Andert
2023-08-07 18:57:19 +02:00
parent beeb298c35
commit 1ad46b3252
18 changed files with 51 additions and 58 deletions

View File

@ -0,0 +1,25 @@
// dataLoader.ts
import dataSources from 'virtual:data-sources-list';
import { writable } from 'svelte/store';
import { coreServices } from './coreServices';
// 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 => {
const moduleData = module[src] || module.default;
queryStore.update(store => ({ ...store, [src]: moduleData }));
});
});
export function subscribeAndMapQueries(id: string, queryMap: Record<string, any>) {
Object.entries(queryMap).forEach(([name, query]) => {
query.subscribe((value) => {
if (value) {
coreServices.mutateStore(id, { [name]: value });
}
});
});
}