This commit is contained in:
2024-03-16 00:15:54 +01:00
parent 91978ce03c
commit 7cf76bc7c7
2 changed files with 14 additions and 10 deletions

View File

@@ -5,14 +5,16 @@ import {t} from "astro-i18n";
---
<PageLayout title={t("dashboard.page")}>
<script is:inline data-astro-rerun type="module">
<script>
import {l} from "../util/util";
import {navigate} from "astro:transitions/client";
if (window.location.href.endsWith("/dashboard") || window.location.href.endsWith("/dashboard/")) {
if ((localStorage.getItem("sw-session") ?? "") === "") {
navigate(l("/login"), {});
document.addEventListener("astro:page-load", () => {
if (window.location.href.endsWith("/dashboard") || window.location.href.endsWith("/dashboard/")) {
if ((localStorage.getItem("sw-session") ?? "") === "") {
navigate(l("/login"), {});
}
}
}
});
</script>
<Dashboard client:only="svelte" />
</PageLayout>