// Start / stop buttons.
"use strict";

import { api } from "./api.js";

export function setupServerControls() {
    document.getElementById("btnStart").addEventListener("click", async () => {
        try { await api("/api/server/start", { method: "POST" }); }
        catch (e) { alert(e.message); }
    });
    document.getElementById("btnStop").addEventListener("click", async () => {
        if (!confirm("Stop the server?")) return;
        try { await api("/api/server/stop", { method: "POST" }); }
        catch (e) { alert(e.message); }
    });
}
