---
import Dashboard from "../components/Dashboard.svelte";
import {AES} from "crypto-js";
import {l} from "../util/util";
import PageLayout from "../layouts/PageLayout.astro";
import {t} from "astro-i18n";
---

<PageLayout title={t("dashboard.page")}>
    <script>
        import {AES} from "crypto-js";
        import {l} from "../util/util";
        if (AES.decrypt(localStorage.getItem("sw-session") ?? "", import.meta.env.PUBLIC_SECRET)?.toString() === "") {
            window.location.href = l("/login");
        }
    </script>
    <Dashboard client:only="svelte" />
</PageLayout>