Initial Commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { assetReport, session } from '$lib/server/application';
|
||||
export const load: PageServerLoad = async (event) => ({ result: await assetReport((await session(event))?.userId ?? null) });
|
||||
@@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { invalidateAll } from '$app/navigation';
|
||||
import AssetResult from '$lib/components/AssetResult.svelte';
|
||||
let { data } = $props();
|
||||
let busy = $state(false); let failure = $state('');
|
||||
async function sync() {
|
||||
busy = true; failure = '';
|
||||
try {
|
||||
const response = await fetch('/api/sync', { method: 'POST' });
|
||||
const body = await response.json();
|
||||
if (!response.ok) throw new Error(body.error ?? 'Synchronization failed');
|
||||
await invalidateAll();
|
||||
} catch (error) { failure = error instanceof Error ? error.message : 'Synchronization failed'; }
|
||||
finally { busy = false; }
|
||||
}
|
||||
</script>
|
||||
<div class="row spread"><div><p class="eyebrow">SHARED DOMAIN VIEW</p><h1>Assets</h1></div><button class="quiet" disabled={busy} onclick={sync}>{busy ? 'Synchronizing…' : 'Synchronize characters'}</button></div>
|
||||
<p class="muted">All connected characters. The same deterministic report used by the assistant.</p>
|
||||
{#if failure}<p class="error" role="alert">{failure}</p>{/if}
|
||||
<AssetResult result={data.result} onSync={sync} />
|
||||
Reference in New Issue
Block a user