初始提交: 配置管理面板 (Vite 8 + Svelte 5 + Bulma)

This commit is contained in:
hermes
2026-06-28 11:31:25 +00:00
commit 3ca80674a1
14 changed files with 1811 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { onMount } from 'svelte';
import { getDevice, putDevice } from '../lib/api.js';
let config = $state({});
let loading = $state(false);
let error = $state(null);
onMount(async () => {
loading = true;
try {
const data = await getDevice();
config = { ...data };
} catch (e) {
error = e.message;
} finally {
loading = false;
}
});
function handleSave(event: Event) {
event.preventDefault();
putDevice(config).then(() => window.location.reload());
}