1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-17 01:06:46 +01:00

fix(web): i18n race condition in load function (#10693)

This commit is contained in:
Michel Heusschen 2024-06-29 18:29:56 +02:00 committed by GitHub
parent 24c1855899
commit 8f553ddb39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 74 additions and 89 deletions

13
web/src/lib/utils/i18n.ts Normal file
View file

@ -0,0 +1,13 @@
import { locale, t, waitLocale } from 'svelte-i18n';
import { get, type Unsubscriber } from 'svelte/store';
export async function getFormatter() {
let unsubscribe: Unsubscriber | undefined;
await new Promise((resolve) => {
unsubscribe = locale.subscribe((value) => value && resolve(value));
});
unsubscribe?.();
await waitLocale();
return get(t);
}

View file

@ -1,14 +1,13 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAllAlbums } from '@immich/sdk'; import { getAllAlbums } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const sharedAlbums = await getAllAlbums({ shared: true }); const sharedAlbums = await getAllAlbums({ shared: true });
const albums = await getAllAlbums({}); const albums = await getAllAlbums({});
const $t = get(t); const $t = await getFormatter();
return { return {
albums, albums,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAllPeople, getExploreData } from '@immich/sdk'; import { getAllPeople, getExploreData } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const [items, response] = await Promise.all([getExploreData(), getAllPeople({ withHidden: false })]); const [items, response] = await Promise.all([getExploreData(), getAllPeople({ withHidden: false })]);
const $t = get(t); const $t = await getFormatter();
return { return {
items, items,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
const user = await authenticate(); const user = await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
user, user,

View file

@ -1,8 +1,7 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getUser } from '@immich/sdk'; import { getUser } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
@ -10,7 +9,7 @@ export const load = (async ({ params }) => {
const partner = await getUser({ id: params.userId }); const partner = await getUser({ id: params.userId });
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,14 +1,13 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAllPeople } from '@immich/sdk'; import { getAllPeople } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const people = await getAllPeople({ withHidden: true }); const people = await getAllPeople({ withHidden: true });
const $t = get(t); const $t = await getFormatter();
return { return {
people, people,

View file

@ -1,8 +1,7 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getPerson, getPersonStatistics } from '@immich/sdk'; import { getPerson, getPersonStatistics } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
@ -13,7 +12,7 @@ export const load = (async ({ params }) => {
getPersonStatistics({ id: params.personId }), getPersonStatistics({ id: params.personId }),
getAssetInfoFromParam(params), getAssetInfoFromParam(params),
]); ]);
const $t = get(t); const $t = await getFormatter();
return { return {
person, person,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetsByCity } from '@immich/sdk'; import { getAssetsByCity } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const items = await getAssetsByCity(); const items = await getAssetsByCity();
const $t = get(t); const $t = await getFormatter();
return { return {
items, items,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,22 +1,21 @@
import { getAssetThumbnailUrl, setSharedLink } from '$lib/utils'; import { getAssetThumbnailUrl, setSharedLink } from '$lib/utils';
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getMySharedLink, isHttpError } from '@immich/sdk'; import { getMySharedLink, isHttpError } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
const { key } = params; const { key } = params;
await authenticate({ public: true }); await authenticate({ public: true });
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t);
try { try {
const sharedLink = await getMySharedLink({ key }); const sharedLink = await getMySharedLink({ key });
setSharedLink(sharedLink); setSharedLink(sharedLink);
const assetCount = sharedLink.assets.length; const assetCount = sharedLink.assets.length;
const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id; const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id;
const $t = await getFormatter();
return { return {
sharedLink, sharedLink,
@ -30,6 +29,7 @@ export const load = (async ({ params }) => {
}; };
} catch (error) { } catch (error) {
if (isHttpError(error) && error.data.message === 'Invalid password') { if (isHttpError(error) && error.data.message === 'Invalid password') {
const $t = await getFormatter();
return { return {
passwordRequired: true, passwordRequired: true,
sharedLinkKey: key, sharedLinkKey: key,

View file

@ -1,14 +1,13 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAllAlbums, getPartners } from '@immich/sdk'; import { getAllAlbums, getPartners } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const sharedAlbums = await getAllAlbums({ shared: true }); const sharedAlbums = await getAllAlbums({ shared: true });
const partners = await getPartners({ direction: 'shared-with' }); const partners = await getPartners({ direction: 'shared-with' });
const $t = get(t); const $t = await getFormatter();
return { return {
sharedAlbums, sharedAlbums,

View file

@ -1,11 +1,10 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { t } from 'svelte-i18n'; import { getFormatter } from '$lib/utils/i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate(); await authenticate();
const $t = get(t); const $t = await getFormatter();
return { return {
meta: { meta: {

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,7 +1,6 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getApiKeys, getSessions } from '@immich/sdk'; import { getApiKeys, getSessions } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
@ -9,7 +8,7 @@ export const load = (async () => {
const keys = await getApiKeys(); const keys = await getApiKeys();
const sessions = await getSessions(); const sessions = await getSessions();
const $t = get(t); const $t = await getFormatter();
return { return {
keys, keys,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,15 +1,14 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation'; import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getAssetDuplicates } from '@immich/sdk'; import { getAssetDuplicates } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
await authenticate(); await authenticate();
const asset = await getAssetInfoFromParam(params); const asset = await getAssetInfoFromParam(params);
const duplicates = await getAssetDuplicates(); const duplicates = await getAssetDuplicates();
const $t = get(t); const $t = await getFormatter();
return { return {
asset, asset,

View file

@ -1,8 +1,7 @@
import { AppRoute } from '$lib/constants'; import { AppRoute } from '$lib/constants';
import { getFormatter } from '$lib/utils/i18n';
import { getServerConfig } from '@immich/sdk'; import { getServerConfig } from '@immich/sdk';
import { redirect } from '@sveltejs/kit'; import { redirect } from '@sveltejs/kit';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import { loadUser } from '../lib/utils/auth'; import { loadUser } from '../lib/utils/auth';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
@ -21,7 +20,7 @@ export const load = (async () => {
redirect(302, AppRoute.AUTH_LOGIN); redirect(302, AppRoute.AUTH_LOGIN);
} }
const $t = get(t); const $t = await getFormatter();
return { return {
meta: { meta: {

View file

@ -1,14 +1,13 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAllJobsStatus } from '@immich/sdk'; import { getAllJobsStatus } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate({ admin: true }); await authenticate({ admin: true });
const jobs = await getAllJobsStatus(); const jobs = await getAllJobsStatus();
const $t = get(t); const $t = await getFormatter();
return { return {
jobs, jobs,

View file

@ -1,14 +1,13 @@
import { authenticate, requestServerInfo } from '$lib/utils/auth'; import { authenticate, requestServerInfo } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { searchUsersAdmin } from '@immich/sdk'; import { searchUsersAdmin } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate({ admin: true }); await authenticate({ admin: true });
await requestServerInfo(); await requestServerInfo();
const allUsers = await searchUsersAdmin({ withDeleted: false }); const allUsers = await searchUsersAdmin({ withDeleted: false });
const $t = get(t); const $t = await getFormatter();
return { return {
allUsers, allUsers,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAuditFiles } from '@immich/sdk'; import { getAuditFiles } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate({ admin: true }); await authenticate({ admin: true });
const { orphans, extras } = await getAuditFiles(); const { orphans, extras } = await getAuditFiles();
const $t = get(t); const $t = await getFormatter();
return { return {
orphans, orphans,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getServerStatistics } from '@immich/sdk'; import { getServerStatistics } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate({ admin: true }); await authenticate({ admin: true });
const stats = await getServerStatistics(); const stats = await getServerStatistics();
const $t = get(t); const $t = await getFormatter();
return { return {
stats, stats,

View file

@ -1,13 +1,12 @@
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getConfig } from '@immich/sdk'; import { getConfig } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate({ admin: true }); await authenticate({ admin: true });
const configs = await getConfig(); const configs = await getConfig();
const $t = get(t); const $t = await getFormatter();
return { return {
configs, configs,

View file

@ -1,14 +1,13 @@
import { authenticate, requestServerInfo } from '$lib/utils/auth'; import { authenticate, requestServerInfo } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { searchUsersAdmin } from '@immich/sdk'; import { searchUsersAdmin } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate({ admin: true }); await authenticate({ admin: true });
await requestServerInfo(); await requestServerInfo();
const allUsers = await searchUsersAdmin({ withDeleted: true }); const allUsers = await searchUsersAdmin({ withDeleted: true });
const $t = get(t); const $t = await getFormatter();
return { return {
allUsers, allUsers,

View file

@ -1,8 +1,8 @@
import { AppRoute } from '$lib/constants'; import { AppRoute } from '$lib/constants';
import { user } from '$lib/stores/user.store'; import { user } from '$lib/stores/user.store';
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { redirect } from '@sveltejs/kit'; import { redirect } from '@sveltejs/kit';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store'; import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
@ -12,7 +12,7 @@ export const load = (async () => {
redirect(302, AppRoute.PHOTOS); redirect(302, AppRoute.PHOTOS);
} }
const $t = get(t); const $t = await getFormatter();
return { return {
meta: { meta: {

View file

@ -1,8 +1,7 @@
import { AppRoute } from '$lib/constants'; import { AppRoute } from '$lib/constants';
import { getFormatter } from '$lib/utils/i18n';
import { defaults, getServerConfig } from '@immich/sdk'; import { defaults, getServerConfig } from '@immich/sdk';
import { redirect } from '@sveltejs/kit'; import { redirect } from '@sveltejs/kit';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async ({ fetch }) => { export const load = (async ({ fetch }) => {
@ -13,7 +12,7 @@ export const load = (async ({ fetch }) => {
redirect(302, AppRoute.AUTH_REGISTER); redirect(302, AppRoute.AUTH_REGISTER);
} }
const $t = get(t); const $t = await getFormatter();
return { return {
meta: { meta: {
title: $t('login'), title: $t('login'),

View file

@ -1,14 +1,13 @@
import { loadConfig } from '$lib/stores/server-config.store'; import { loadConfig } from '$lib/stores/server-config.store';
import { authenticate } from '$lib/utils/auth'; import { authenticate } from '$lib/utils/auth';
import { t } from 'svelte-i18n'; import { getFormatter } from '$lib/utils/i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
await authenticate({ admin: true }); await authenticate({ admin: true });
await loadConfig(); await loadConfig();
const $t = get(t); const $t = await getFormatter();
return { return {
meta: { meta: {

View file

@ -1,8 +1,7 @@
import { AppRoute } from '$lib/constants'; import { AppRoute } from '$lib/constants';
import { getFormatter } from '$lib/utils/i18n';
import { getServerConfig } from '@immich/sdk'; import { getServerConfig } from '@immich/sdk';
import { redirect } from '@sveltejs/kit'; import { redirect } from '@sveltejs/kit';
import { t } from 'svelte-i18n';
import { get } from 'svelte/store';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load = (async () => { export const load = (async () => {
@ -12,7 +11,7 @@ export const load = (async () => {
redirect(302, AppRoute.AUTH_LOGIN); redirect(302, AppRoute.AUTH_LOGIN);
} }
const $t = get(t); const $t = await getFormatter();
return { return {
meta: { meta: {