Files
agent/apps/web/src/app/App.svelte

22 lines
665 B
Svelte
Raw Normal View History

2026-07-18 16:40:09 +08:00
<script lang="ts">
import ServerLogin from '../features/auth/ServerLogin.svelte';
let apiBase = localStorage.getItem('apiBase') ?? 'http://localhost:8080';
2026-07-19 19:01:27 +08:00
let currentUser: { account: string } | null = null;
2026-07-19 19:01:27 +08:00
function handleLogin(detail: { apiBase: string; account: string }) {
apiBase = detail.apiBase;
2026-07-18 16:40:09 +08:00
localStorage.setItem('apiBase', apiBase);
2026-07-19 19:01:27 +08:00
currentUser = { account: detail.account };
2026-07-18 16:40:09 +08:00
}
</script>
2026-07-19 19:01:27 +08:00
{#if currentUser}
<main class="workbench-placeholder" aria-label="Project workbench">
<h1>SenlinAI Workbench</h1>
<p>Signed in as {currentUser.account}</p>
</main>
{:else}
<ServerLogin {apiBase} onLogin={handleLogin} />
{/if}