mirror of
https://github.com/immich-app/immich.git
synced 2025-12-27 09:14:55 +03:00
29 lines
655 B
TypeScript
29 lines
655 B
TypeScript
import { eventManager } from '$lib/managers/event-manager.svelte';
|
|
import { getServerConfig, type ServerConfigDto } from '@immich/sdk';
|
|
|
|
class ServerConfigManager {
|
|
#value?: ServerConfigDto = $state();
|
|
|
|
constructor() {
|
|
eventManager.on('SystemConfigUpdate', () => void this.loadServerConfig());
|
|
}
|
|
|
|
async init() {
|
|
await this.loadServerConfig();
|
|
}
|
|
|
|
get value() {
|
|
if (!this.#value) {
|
|
throw new Error('Server config manager must be initialized first');
|
|
}
|
|
|
|
return this.#value;
|
|
}
|
|
|
|
async loadServerConfig() {
|
|
this.#value = await getServerConfig();
|
|
}
|
|
}
|
|
|
|
export const serverConfigManager = new ServerConfigManager();
|