mirror of
https://github.com/immich-app/immich.git
synced 2026-03-07 10:37:22 +03:00
refactor(web): routes (#25313)
This commit is contained in:
@@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user