import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import memberDocs from '../../../docs/member-area.md?raw';
import { renderMarkdown } from '$lib/utils/markdown';

export const load: PageServerLoad = async ({ locals }) => {
	if (!locals.member) {
		throw redirect(303, '/login');
	}

	return {
		member: locals.member,
		html: renderMarkdown(memberDocs)
	};
};
