This commit is contained in:
2026-01-12 19:03:50 +00:00
parent 0da76927ce
commit d4b8dcd455
48 changed files with 1352 additions and 723 deletions
+6 -1
View File
@@ -1,6 +1,7 @@
// src/api.js
const API_BASE = import.meta.env.VITE_BOX_API_URL || "http://10.10.10.23:8000";
const API_TOKEN = import.meta.env.VITE_BOX_API_TOKEN || "";
export async function getStatus() {
const response = await fetch(`${API_BASE}/status`);
@@ -12,9 +13,13 @@ export async function getStatus() {
export async function sendCommand(command, payload = {}) {
console.log("GUI -> API", command, payload);
const headers = { "Content-Type": "application/json" };
if (API_TOKEN) {
headers["X-API-Token"] = API_TOKEN;
}
const response = await fetch(`${API_BASE}/command`, {
method: "POST",
headers: { "Content-Type": "application/json" },
headers,
body: JSON.stringify({ command, payload }),
});
if (!response.ok) {