fix: admin page script crashes — define:vars bypasses TypeScript compilation; use data attribute instead
This commit is contained in:
@@ -3,7 +3,7 @@ import Base from '../../layouts/Base.astro';
|
|||||||
const authUrl = import.meta.env.PUBLIC_AUTH_URL ?? '';
|
const authUrl = import.meta.env.PUBLIC_AUTH_URL ?? '';
|
||||||
---
|
---
|
||||||
<Base title="Admin — BincioActivity">
|
<Base title="Admin — BincioActivity">
|
||||||
<div class="max-w-3xl mx-auto px-4 py-10">
|
<div class="max-w-3xl mx-auto px-4 py-10" data-auth-url={authUrl}>
|
||||||
<h1 class="text-2xl font-bold text-white mb-8">Admin</h1>
|
<h1 class="text-2xl font-bold text-white mb-8">Admin</h1>
|
||||||
|
|
||||||
<!-- Disk overview -->
|
<!-- Disk overview -->
|
||||||
@@ -113,7 +113,8 @@ const authUrl = import.meta.env.PUBLIC_AUTH_URL ?? '';
|
|||||||
</div>
|
</div>
|
||||||
</Base>
|
</Base>
|
||||||
|
|
||||||
<script define:vars={{ authUrl }}>
|
<script>
|
||||||
|
const authUrl = (document.querySelector<HTMLElement>('.max-w-3xl[data-auth-url]')?.dataset.authUrl) ?? '';
|
||||||
const overviewEl = document.getElementById('disk-overview')!;
|
const overviewEl = document.getElementById('disk-overview')!;
|
||||||
const tbodyEl = document.getElementById('user-list')!;
|
const tbodyEl = document.getElementById('user-list')!;
|
||||||
const dialog = document.getElementById('confirm-dialog') as HTMLDialogElement;
|
const dialog = document.getElementById('confirm-dialog') as HTMLDialogElement;
|
||||||
|
|||||||
Reference in New Issue
Block a user