fix: Update script tags to remove inline type and improve page load handling in dashboard and login pages
SteamWarCI Build successful
SteamWarCI Build successful
This commit is contained in:
@@ -5,16 +5,18 @@ import { t } from "astro-i18n";
|
||||
---
|
||||
|
||||
<PageLayout title={t("dashboard.page")}>
|
||||
<script is:inline type="module" data-astro-rerun>
|
||||
<script>
|
||||
import { l } from "../util/util";
|
||||
import { navigate } from "astro:transitions/client";
|
||||
import { loggedIn } from "../components/repo/authv2";
|
||||
loggedIn.subscribe((value) => {
|
||||
if (window.location.href.endsWith("/dashboard") || window.location.href.endsWith("/dashboard/")) {
|
||||
if (value === false) {
|
||||
navigate(l("/dashboard"), { history: "replace" });
|
||||
document.addEventListener("astro:page-load", () => {
|
||||
loggedIn.subscribe((value) => {
|
||||
if (window.location.href.endsWith("/dashboard") || window.location.href.endsWith("/dashboard/")) {
|
||||
if (value === false) {
|
||||
navigate(l("/dashboard"), { history: "replace" });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<DashboardComponent client:only="svelte" />
|
||||
|
||||
@@ -6,17 +6,18 @@ import BackgroundImage from "../components/BackgroundImage.astro";
|
||||
---
|
||||
|
||||
<NavbarLayout title={t("login.page")}>
|
||||
<script is:inline type="module" data-astro-rerun>
|
||||
<script>
|
||||
import { l } from "../util/util";
|
||||
import { navigate } from "astro:transitions/client";
|
||||
import { loggedIn } from "../components/repo/authv2";
|
||||
|
||||
loggedIn.subscribe((value) => {
|
||||
if (window.location.href.endsWith("/login") || window.location.href.endsWith("/login/")) {
|
||||
if (value) {
|
||||
navigate(l("/dashboard"), { history: "replace" });
|
||||
document.addEventListener("astro:page-load", () => {
|
||||
loggedIn.subscribe((value) => {
|
||||
if (window.location.href.endsWith("/login") || window.location.href.endsWith("/login/")) {
|
||||
if (value) {
|
||||
navigate(l("/dashboard"), { history: "replace" });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="h-screen w-screen fixed -z-10">
|
||||
|
||||
Reference in New Issue
Block a user