Dashboard UI overhaul: modern design with system stats, SVG icons, Inter font, theme toggle, loading states, and log modal

This commit is contained in:
Gan, Jimmy
2026-02-19 02:29:25 +08:00
parent ae1b88732d
commit f3db7d3654
13 changed files with 854 additions and 188 deletions
+29 -9
View File
@@ -1,13 +1,33 @@
const BASE = "/api";
export async function get(path) {
const r = await fetch(BASE + path);
return r.json();
async function request(path, opts = {}) {
try {
const r = await fetch(BASE + path, opts);
if (!r.ok) throw new Error(`HTTP ${r.status}`);
return r.json();
} catch (e) {
console.error(`API ${opts.method || "GET"} ${path}:`, e);
return null;
}
}
export async function post(path) {
const r = await fetch(BASE + path, { method: "POST" });
return r.json();
export function get(path) {
return request(path);
}
export async function del(path) {
const r = await fetch(BASE + path, { method: "DELETE" });
return r.json();
export function post(path) {
return request(path, { method: "POST" });
}
export function del(path) {
return request(path, { method: "DELETE" });
}
export async function upload(path, file) {
const form = new FormData();
form.append("file", file);
return request(`/files/upload?path=${encodeURIComponent(path)}`, {
method: "POST",
body: form,
});
}