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,10 +5,11 @@ import { t } from "astro-i18n";
|
|||||||
---
|
---
|
||||||
|
|
||||||
<PageLayout title={t("dashboard.page")}>
|
<PageLayout title={t("dashboard.page")}>
|
||||||
<script is:inline type="module" data-astro-rerun>
|
<script>
|
||||||
import { l } from "../util/util";
|
import { l } from "../util/util";
|
||||||
import { navigate } from "astro:transitions/client";
|
import { navigate } from "astro:transitions/client";
|
||||||
import { loggedIn } from "../components/repo/authv2";
|
import { loggedIn } from "../components/repo/authv2";
|
||||||
|
document.addEventListener("astro:page-load", () => {
|
||||||
loggedIn.subscribe((value) => {
|
loggedIn.subscribe((value) => {
|
||||||
if (window.location.href.endsWith("/dashboard") || window.location.href.endsWith("/dashboard/")) {
|
if (window.location.href.endsWith("/dashboard") || window.location.href.endsWith("/dashboard/")) {
|
||||||
if (value === false) {
|
if (value === false) {
|
||||||
@@ -16,6 +17,7 @@ import { t } from "astro-i18n";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<DashboardComponent client:only="svelte" />
|
<DashboardComponent client:only="svelte" />
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import BackgroundImage from "../components/BackgroundImage.astro";
|
|||||||
---
|
---
|
||||||
|
|
||||||
<NavbarLayout title={t("login.page")}>
|
<NavbarLayout title={t("login.page")}>
|
||||||
<script is:inline type="module" data-astro-rerun>
|
<script>
|
||||||
import { l } from "../util/util";
|
import { l } from "../util/util";
|
||||||
import { navigate } from "astro:transitions/client";
|
import { navigate } from "astro:transitions/client";
|
||||||
import { loggedIn } from "../components/repo/authv2";
|
import { loggedIn } from "../components/repo/authv2";
|
||||||
|
document.addEventListener("astro:page-load", () => {
|
||||||
loggedIn.subscribe((value) => {
|
loggedIn.subscribe((value) => {
|
||||||
if (window.location.href.endsWith("/login") || window.location.href.endsWith("/login/")) {
|
if (window.location.href.endsWith("/login") || window.location.href.endsWith("/login/")) {
|
||||||
if (value) {
|
if (value) {
|
||||||
@@ -18,6 +18,7 @@ import BackgroundImage from "../components/BackgroundImage.astro";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<div class="h-screen w-screen fixed -z-10">
|
<div class="h-screen w-screen fixed -z-10">
|
||||||
<BackgroundImage />
|
<BackgroundImage />
|
||||||
|
|||||||
Reference in New Issue
Block a user