feat(web): continue after login (#18302)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user