---
import UserLayout from "#layouts/UserLayout.astro";
import { createCaller } from "#lib/caller";
import DashboardEinstellungenModule from "#modules/Dashboard/DashboardEinstellungenModule.svelte";
import { validateAccessTokenServer } from "#server/lib/validateAccessToken";

const valid = await validateAccessTokenServer(Astro);

if (!valid) {
	return Astro.redirect("/auth/login", 302);
}

const caller = createCaller(Astro);
const benutzer = await caller.v1.benutzer.self();

---

<UserLayout title="Einstellungen">
	<DashboardEinstellungenModule benutzer={benutzer} client:load />
</UserLayout>