mirror of
https://github.com/Art051/immich.git
synced 2025-08-11 19:29:00 +00:00
24 lines
510 B
TypeScript
24 lines
510 B
TypeScript
export const prerender = false;
|
|
|
|
import { redirect } from '@sveltejs/kit';
|
|
import type { PageServerLoad } from './$types';
|
|
|
|
export const load = (async ({ locals: { api } }) => {
|
|
try {
|
|
const { data: userInfo } = await api.userApi.getMyUserInfo();
|
|
|
|
if (userInfo.shouldChangePassword) {
|
|
return {
|
|
user: userInfo,
|
|
meta: {
|
|
title: 'Change Password'
|
|
}
|
|
};
|
|
} else {
|
|
throw redirect(302, '/photos');
|
|
}
|
|
} catch (e) {
|
|
throw redirect(302, '/auth/login');
|
|
}
|
|
}) satisfies PageServerLoad;
|