2024-09-09 10:29:41 +02:00
|
|
|
import AppConfigService from '$lib/services/app-config-service';
|
|
|
|
|
import type { AppConfig } from '$lib/types/application-configuration';
|
2024-08-12 11:00:25 +02:00
|
|
|
import { writable } from 'svelte/store';
|
|
|
|
|
|
2024-09-09 10:29:41 +02:00
|
|
|
const appConfigStore = writable<AppConfig>();
|
2024-08-12 11:00:25 +02:00
|
|
|
|
2024-09-09 10:29:41 +02:00
|
|
|
const appConfigService = new AppConfigService();
|
2024-08-12 11:00:25 +02:00
|
|
|
|
|
|
|
|
const reload = async () => {
|
2024-09-09 10:29:41 +02:00
|
|
|
const appConfig = await appConfigService.list();
|
|
|
|
|
appConfigStore.set(appConfig);
|
2024-08-12 11:00:25 +02:00
|
|
|
};
|
|
|
|
|
|
2024-09-09 10:29:41 +02:00
|
|
|
const set = (appConfig: AppConfig) => {
|
|
|
|
|
appConfigStore.set(appConfig);
|
|
|
|
|
};
|
2024-08-12 11:00:25 +02:00
|
|
|
|
|
|
|
|
export default {
|
2024-09-09 10:29:41 +02:00
|
|
|
subscribe: appConfigStore.subscribe,
|
2024-08-12 11:00:25 +02:00
|
|
|
reload,
|
|
|
|
|
set
|
|
|
|
|
};
|