Files
Immich/web/src/lib/utils/server.ts
T
bo0tzz 6221e29c70 fix: throw a typed error on malformed api responses (#31006)
* fix: throw a typed error on malformed api responses

* fix: drop response body parse check

* fix(web): keep json response validation when overriding fetch (#31008)

* fix(cli): report malformed api responses (#31007)
2026-08-26 00:38:39 +00:00

25 lines
874 B
TypeScript

import { setFetch } from '@immich/sdk';
import { memoize } from 'lodash-es';
import { authManager } from '$lib/managers/auth-manager.svelte';
import { featureFlagsManager } from '$lib/managers/feature-flags-manager.svelte';
import { serverConfigManager } from '$lib/managers/server-config-manager.svelte';
import { initLanguage } from '$lib/utils';
type Fetch = typeof fetch;
async function _init(fetch: Fetch) {
// set event.fetch on the fetch-client used by @immich/sdk
// https://kit.svelte.dev/docs/load#making-fetch-requests
// https://github.com/oazapfts/oazapfts/blob/main/README.md#fetch-options
setFetch(fetch);
await initLanguage();
await serverConfigManager.init();
await authManager.load();
if (!serverConfigManager.value.maintenanceMode) {
await featureFlagsManager.init();
}
}
export const init = memoize(_init, () => 'singlevalue');