2024-11-09 19:05:28 +00:00
|
|
|
import { notSignedInMessage } from '$lib/flashMessages';
|
|
|
|
|
import { redirect } from 'sveltekit-flash-message/server';
|
|
|
|
|
import type { PageServerLoad } from './$types';
|
2024-09-07 00:35:16 +00:00
|
|
|
|
|
|
|
|
export const load: PageServerLoad = async (event) => {
|
2024-11-09 19:05:28 +00:00
|
|
|
const { locals } = event;
|
2024-09-07 00:35:16 +00:00
|
|
|
|
2024-11-09 19:05:28 +00:00
|
|
|
const authedUser = await locals.getAuthedUser();
|
2024-09-07 00:35:16 +00:00
|
|
|
if (!authedUser) {
|
2024-11-09 19:05:28 +00:00
|
|
|
throw redirect(302, '/login', notSignedInMessage, event);
|
2024-09-07 00:35:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
hasSetupTwoFactor: authedUser.mfa_enabled,
|
2024-11-09 19:05:28 +00:00
|
|
|
};
|
|
|
|
|
};
|
2024-09-07 00:35:16 +00:00
|
|
|
|
2024-11-09 19:05:28 +00:00
|
|
|
export const actions = {};
|