Skip to content

High performance self-hosted photo and video management solution.

feat(web): continue after login (#18302)

Jason Rasmussenc046651f234d
diff --git a/web/src/lib/utils/auth.ts b/web/src/lib/utils/auth.ts
index 9b78c345e2..c22b706631 100644
--- a/web/src/lib/utils/auth.ts
+++ b/web/src/lib/utils/auth.ts
@@ -50,7 +50,7 @@ const hasAuthCookie = (): boolean => {
return false;
};
-export const authenticate = async (options?: AuthOptions) => {
+export const authenticate = async (url: URL, options?: AuthOptions) => {
const { public: publicRoute, admin: adminRoute } = options || {};
const user = await loadUser();
@@ -59,7 +59,7 @@ export const authenticate = async (options?: AuthOptions) => {
}
if (!user) {
- redirect(302, AppRoute.AUTH_LOGIN);
+ redirect(302, `${AppRoute.AUTH_LOGIN}?continue=${encodeURIComponent(url.pathname + url.search)}`);
}
if (adminRoute && !user.isAdmin) {
diff --git a/web/src/routes/(user)/albums/+page.ts b/web/src/routes/(user)/albums/+page.ts
index e56d0f06b7..f4527d56d2 100644
--- a/web/src/routes/(user)/albums/+page.ts
+++ b/web/src/routes/(user)/albums/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAllAlbums } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate();
+export const load = (async ({ url }) => {
+ await authenticate(url);
const sharedAlbums = await getAllAlbums({ shared: true });
const albums = await getAllAlbums({});
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.ts
index 0143390974..f8691b5fd1 100644
--- a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -3,8 +3,8 @@ import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getAlbumInfo } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const [album, asset] = await Promise.all([
getAlbumInfo({ id: params.albumId, withoutAssets: true }),
getAssetInfoFromParam(params),
diff --git a/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.ts
index c44ba64d5b..f5d4560505 100644
--- a/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/buy/+page.ts b/web/src/routes/(user)/buy/+page.ts
index ba55948b1e..d0180b39ff 100644
--- a/web/src/routes/(user)/buy/+page.ts
+++ b/web/src/routes/(user)/buy/+page.ts
@@ -5,7 +5,7 @@ import { activateProduct, getActivationKey } from '$lib/utils/license-utils';
import type { PageLoad } from './$types';
export const load = (async ({ url }) => {
- await authenticate();
+ await authenticate(url);
const $t = await getFormatter();
const licenseKey = url.searchParams.get('licenseKey');
diff --git a/web/src/routes/(user)/explore/+page.ts b/web/src/routes/(user)/explore/+page.ts
index 84ec944efe..9005f7dced 100644
--- a/web/src/routes/(user)/explore/+page.ts
+++ b/web/src/routes/(user)/explore/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAllPeople, getExploreData } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate();
+export const load = (async ({ url }) => {
+ await authenticate(url);
const [items, response] = await Promise.all([getExploreData(), getAllPeople({ withHidden: false })]);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.ts
index be828b69dd..0d9fe7a203 100644
--- a/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.ts
index d00ba238ef..7fd0a749c0 100644
--- a/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -7,7 +7,7 @@ import { buildTree, normalizeTreePath } from '$lib/utils/tree-utils';
import type { PageLoad } from './$types';
export const load = (async ({ params, url }) => {
- await authenticate();
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/map/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/map/[[photos=photos]]/[[assetId=id]]/+page.ts
index 490e1430e6..add9882bcd 100644
--- a/web/src/routes/(user)/map/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/map/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/memory/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/memory/[[photos=photos]]/[[assetId=id]]/+page.ts
index e323fca182..5c030da72f 100644
--- a/web/src/routes/(user)/memory/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/memory/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- const user = await authenticate();
+export const load = (async ({ params, url }) => {
+ const user = await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.ts
index 1395a3e8d3..1977d9a095 100644
--- a/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -4,8 +4,8 @@ import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getUser } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const partner = await getUser({ id: params.userId });
const asset = await getAssetInfoFromParam(params);
diff --git a/web/src/routes/(user)/people/+page.ts b/web/src/routes/(user)/people/+page.ts
index 305ba31da6..35ed6c06c4 100644
--- a/web/src/routes/(user)/people/+page.ts
+++ b/web/src/routes/(user)/people/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAllPeople } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate();
+export const load = (async ({ url }) => {
+ await authenticate(url);
const people = await getAllPeople({ withHidden: true });
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.ts
index 88e223640f..92371bd34e 100644
--- a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -4,8 +4,8 @@ import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getPerson, getPersonStatistics } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const [person, statistics, asset] = await Promise.all([
getPerson({ id: params.personId }),
diff --git a/web/src/routes/(user)/photos/[[assetId=id]]/+page.ts b/web/src/routes/(user)/photos/[[assetId=id]]/+page.ts
index 6e9384f853..209b5483a8 100644
--- a/web/src/routes/(user)/photos/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/photos/[[assetId=id]]/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/places/+page.ts b/web/src/routes/(user)/places/+page.ts
index a0c421ef3a..9449f416be 100644
--- a/web/src/routes/(user)/places/+page.ts
+++ b/web/src/routes/(user)/places/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetsByCity } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate();
+export const load = (async ({ url }) => {
+ await authenticate(url);
const items = await getAssetsByCity();
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.ts
index 23871d8bdf..82dd18acaa 100644
--- a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/share/[key]/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/share/[key]/[[photos=photos]]/[[assetId=id]]/+page.ts
index 66fc3552c7..c0edb5e669 100644
--- a/web/src/routes/(user)/share/[key]/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/share/[key]/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -5,9 +5,9 @@ import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getMySharedLink, isHttpError } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
+export const load = (async ({ params, url }) => {
const { key } = params;
- await authenticate({ public: true });
+ await authenticate(url, { public: true });
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/shared-links/[[id=id]]/+page.ts b/web/src/routes/(user)/shared-links/[[id=id]]/+page.ts
index 920e5bdba4..f61484a910 100644
--- a/web/src/routes/(user)/shared-links/[[id=id]]/+page.ts
+++ b/web/src/routes/(user)/shared-links/[[id=id]]/+page.ts
@@ -2,8 +2,8 @@ import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate();
+export const load = (async ({ url }) => {
+ await authenticate(url);
const $t = await getFormatter();
return {
diff --git a/web/src/routes/(user)/sharing/+page.ts b/web/src/routes/(user)/sharing/+page.ts
index b1872ca9f2..2bf737dfc7 100644
--- a/web/src/routes/(user)/sharing/+page.ts
+++ b/web/src/routes/(user)/sharing/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { PartnerDirection, getAllAlbums, getPartners } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate();
+export const load = (async ({ url }) => {
+ await authenticate(url);
const sharedAlbums = await getAllAlbums({ shared: true });
const partners = await getPartners({ direction: PartnerDirection.SharedWith });
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.ts
index 23846e57c4..6e92eda7d3 100644
--- a/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -7,7 +7,7 @@ import { getAllTags } from '@immich/sdk';
import type { PageLoad } from './$types';
export const load = (async ({ params, url }) => {
- await authenticate();
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/trash/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/trash/[[photos=photos]]/[[assetId=id]]/+page.ts
index 926af322ca..79c41892c7 100644
--- a/web/src/routes/(user)/trash/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/trash/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/user-settings/+page.ts b/web/src/routes/(user)/user-settings/+page.ts
index 15b8d8125c..bf36eeefb5 100644
--- a/web/src/routes/(user)/user-settings/+page.ts
+++ b/web/src/routes/(user)/user-settings/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getApiKeys, getSessions } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate();
+export const load = (async ({ url }) => {
+ await authenticate(url);
const keys = await getApiKeys();
const sessions = await getSessions();
diff --git a/web/src/routes/(user)/utilities/+page.ts b/web/src/routes/(user)/utilities/+page.ts
index a0420a575b..af241d0fd7 100644
--- a/web/src/routes/(user)/utilities/+page.ts
+++ b/web/src/routes/(user)/utilities/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const $t = await getFormatter();
diff --git a/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.ts b/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.ts
index a7faaed3c3..978f50830e 100644
--- a/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.ts
+++ b/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.ts
@@ -4,8 +4,8 @@ import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getAssetDuplicates } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate();
+export const load = (async ({ params, url }) => {
+ await authenticate(url);
const asset = await getAssetInfoFromParam(params);
const duplicates = await getAssetDuplicates();
const $t = await getFormatter();
diff --git a/web/src/routes/admin/jobs-status/+page.ts b/web/src/routes/admin/jobs-status/+page.ts
index 8044b61861..0d4ec8b41f 100644
--- a/web/src/routes/admin/jobs-status/+page.ts
+++ b/web/src/routes/admin/jobs-status/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getAllJobsStatus } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate({ admin: true });
+export const load = (async ({ url }) => {
+ await authenticate(url, { admin: true });
const jobs = await getAllJobsStatus();
const $t = await getFormatter();
diff --git a/web/src/routes/admin/library-management/+page.ts b/web/src/routes/admin/library-management/+page.ts
index 71bc835a6f..735c7fac92 100644
--- a/web/src/routes/admin/library-management/+page.ts
+++ b/web/src/routes/admin/library-management/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { searchUsersAdmin } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate({ admin: true });
+export const load = (async ({ url }) => {
+ await authenticate(url, { admin: true });
await requestServerInfo();
const allUsers = await searchUsersAdmin({ withDeleted: false });
const $t = await getFormatter();
diff --git a/web/src/routes/admin/server-status/+page.ts b/web/src/routes/admin/server-status/+page.ts
index 39ce96ae41..7450550737 100644
--- a/web/src/routes/admin/server-status/+page.ts
+++ b/web/src/routes/admin/server-status/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getServerStatistics } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate({ admin: true });
+export const load = (async ({ url }) => {
+ await authenticate(url, { admin: true });
const stats = await getServerStatistics();
const $t = await getFormatter();
diff --git a/web/src/routes/admin/system-settings/+page.ts b/web/src/routes/admin/system-settings/+page.ts
index 555835e017..294096a4be 100644
--- a/web/src/routes/admin/system-settings/+page.ts
+++ b/web/src/routes/admin/system-settings/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { getConfig } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate({ admin: true });
+export const load = (async ({ url }) => {
+ await authenticate(url, { admin: true });
const configs = await getConfig();
const $t = await getFormatter();
diff --git a/web/src/routes/admin/users/+page.ts b/web/src/routes/admin/users/+page.ts
index 0a6af40c69..521f8573e1 100644
--- a/web/src/routes/admin/users/+page.ts
+++ b/web/src/routes/admin/users/+page.ts
@@ -3,8 +3,8 @@ import { getFormatter } from '$lib/utils/i18n';
import { searchUsersAdmin } from '@immich/sdk';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate({ admin: true });
+export const load = (async ({ url }) => {
+ await authenticate(url, { admin: true });
await requestServerInfo();
const allUsers = await searchUsersAdmin({ withDeleted: true });
const $t = await getFormatter();
diff --git a/web/src/routes/admin/users/[id]/+page.ts b/web/src/routes/admin/users/[id]/+page.ts
index 7e2930c46a..c6e918d648 100644
--- a/web/src/routes/admin/users/[id]/+page.ts
+++ b/web/src/routes/admin/users/[id]/+page.ts
@@ -5,8 +5,8 @@ import { getUserPreferencesAdmin, getUserStatisticsAdmin, searchUsersAdmin } fro
import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
-export const load = (async ({ params }) => {
- await authenticate({ admin: true });
+export const load = (async ({ params, url }) => {
+ await authenticate(url, { admin: true });
await requestServerInfo();
const [user] = await searchUsersAdmin({ id: params.id, withDeleted: true }).catch(() => []);
if (!user) {
diff --git a/web/src/routes/auth/change-password/+page.ts b/web/src/routes/auth/change-password/+page.ts
index 19abb2e832..c4331b73cc 100644
--- a/web/src/routes/auth/change-password/+page.ts
+++ b/web/src/routes/auth/change-password/+page.ts
@@ -6,8 +6,8 @@ import { redirect } from '@sveltejs/kit';
import { get } from 'svelte/store';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate();
+export const load = (async ({ url }) => {
+ await authenticate(url);
if (!get(user).shouldChangePassword) {
redirect(302, AppRoute.PHOTOS);
}
diff --git a/web/src/routes/auth/login/+page.svelte b/web/src/routes/auth/login/+page.svelte
index fdad88e1ff..5cce88ae2c 100644
--- a/web/src/routes/auth/login/+page.svelte
+++ b/web/src/routes/auth/login/+page.svelte
@@ -26,7 +26,8 @@
let oauthLoading = $state(true);
const onSuccess = async (user: LoginResponseDto) => {
- await goto(AppRoute.PHOTOS, { invalidateAll: true });
+ console.log(data.continueUrl);
+ await goto(data.continueUrl, { invalidateAll: true });
eventManager.emit('auth.login', user);
};
diff --git a/web/src/routes/auth/login/+page.ts b/web/src/routes/auth/login/+page.ts
index 847992ab20..54c5da716a 100644
--- a/web/src/routes/auth/login/+page.ts
+++ b/web/src/routes/auth/login/+page.ts
@@ -6,7 +6,7 @@ import { redirect } from '@sveltejs/kit';
import { get } from 'svelte/store';
import type { PageLoad } from './$types';
-export const load = (async ({ parent }) => {
+export const load = (async ({ parent, url }) => {
await parent();
const { isInitialized } = get(serverConfig);
@@ -20,5 +20,6 @@ export const load = (async ({ parent }) => {
meta: {
title: $t('login'),
},
+ continueUrl: url.searchParams.get('continue') || AppRoute.PHOTOS,
};
}) satisfies PageLoad;
diff --git a/web/src/routes/auth/onboarding/+page.ts b/web/src/routes/auth/onboarding/+page.ts
index db16c8e514..86c19c10a8 100644
--- a/web/src/routes/auth/onboarding/+page.ts
+++ b/web/src/routes/auth/onboarding/+page.ts
@@ -2,8 +2,8 @@ import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import type { PageLoad } from './$types';
-export const load = (async () => {
- await authenticate({ admin: true });
+export const load = (async ({ url }) => {
+ await authenticate(url, { admin: true });
const $t = await getFormatter();