mirror of
https://github.com/Art051/immich.git
synced 2025-08-11 19:29:00 +00:00
fix(web): sharing of access token in server API (#1858)
This commit is contained in:
23
web/src/routes/auth/change-password/+page.server.ts
Normal file
23
web/src/routes/auth/change-password/+page.server.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user