refactor: Update loggedIn store type and streamline login/dashboard navigation logic
Some checks failed
SteamWarCI Build failed

This commit is contained in:
2025-12-17 21:20:46 +01:00
parent 3ffc715929
commit b0a9d56216
3 changed files with 13 additions and 15 deletions

View File

@@ -6,15 +6,14 @@ import BackgroundImage from "../components/BackgroundImage.astro";
---
<NavbarLayout title={t("login.page")}>
<script>
<script is:inline data-astro-rerun>
import { l } from "../util/util";
import { navigate } from "astro:transitions/client";
import { loggedIn } from "../components/repo/authv2";
import { get } from "svelte/store";
document.addEventListener("astro:page-load", () => {
loggedIn.subscribe((value) => {
if (window.location.href.endsWith("/login") || window.location.href.endsWith("/login/")) {
if (get(loggedIn)) {
if (value) {
navigate(l("/dashboard"), { history: "replace" });
}
}