refactor(web): routes (#25313)

This commit is contained in:
Jason Rasmussen
2026-01-16 16:11:09 -05:00
committed by GitHub
parent 07675a2de4
commit 8196bd9bbd
87 changed files with 425 additions and 383 deletions

View File

@@ -1,5 +1,6 @@
import { browser } from '$app/environment';
import { eventManager } from '$lib/managers/event-manager.svelte';
import { Route } from '$lib/route';
import { purchaseStore } from '$lib/stores/purchase.store';
import { preferences as preferences$, user as user$ } from '$lib/stores/user.store';
import { userInteraction } from '$lib/stores/user.svelte';
@@ -7,7 +8,6 @@ import { getAboutInfo, getMyPreferences, getMyUser, getStorage } from '@immich/s
import { redirect } from '@sveltejs/kit';
import { DateTime } from 'luxon';
import { get } from 'svelte/store';
import { AppRoute } from '../constants';
export interface AuthOptions {
admin?: true;
@@ -62,11 +62,11 @@ export const authenticate = async (url: URL, options?: AuthOptions) => {
}
if (!user) {
redirect(307, `${AppRoute.AUTH_LOGIN}?continue=${encodeURIComponent(url.pathname + url.search)}`);
redirect(307, Route.login({ continue: url.pathname + url.search }));
}
if (adminRoute && !user.isAdmin) {
redirect(307, AppRoute.PHOTOS);
redirect(307, Route.photos());
}
};