feat(web): automatically update user info (#5647)
* use svelte store * fix: websocket error when not authenticated * more routes
This commit is contained in:
@@ -2,15 +2,15 @@ import { AppRoute } from '$lib/constants';
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { PageLoad } from './$types';
|
||||
import { getSavedUser } from '$lib/stores/user.store';
|
||||
|
||||
export const load = (async () => {
|
||||
const user = await authenticate();
|
||||
if (!user.shouldChangePassword) {
|
||||
await authenticate();
|
||||
if (!getSavedUser().shouldChangePassword) {
|
||||
throw redirect(302, AppRoute.PHOTOS);
|
||||
}
|
||||
|
||||
return {
|
||||
user,
|
||||
meta: {
|
||||
title: 'Change Password',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user