DUNGEONS-34: implement Webka local streaming app

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-09-06 16:23:09 +05:00
parent 5540b9a1f4
commit 7c737c1011
36 changed files with 21596 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import { defineStore } from "pinia";
export interface User {
id: string;
username: string;
role: "admin" | "viewer";
session_id: string;
}
export const useSessionStore = defineStore("session", () => {
const user = ref<User | null>(null);
const ready = ref(false);
async function refresh() {
try {
user.value = await $fetch<User>("/api/session");
return true;
} catch {
user.value = null;
return false;
} finally {
ready.value = true;
}
}
async function logout() {
try {
await $fetch("/api/logout", { method: "POST" });
} finally {
user.value = null;
await navigateTo("/login");
}
}
return { user, ready, refresh, logout };
});