+
Name required
diff --git a/wwwroot/js/api.js b/wwwroot/js/api.js
index bb633c3..a94a0d5 100644
--- a/wwwroot/js/api.js
+++ b/wwwroot/js/api.js
@@ -24,7 +24,9 @@ async function request(path, { method = "GET", body, adminKey } = {}) {
const data = await res.json();
msg = data.error || JSON.stringify(data);
} catch { /* ignore */ }
- throw new Error(msg);
+ const err = new Error(msg);
+ err.status = res.status;
+ throw err;
}
return res.status === 204 ? null : res.json();
}
@@ -33,6 +35,9 @@ export const api = {
state: () => request("/api/state"),
me: () => request("/api/me"),
setName: (name) => request("/api/me/name", { method: "POST", body: { name } }),
+ register: (payload) => request("/api/auth/register", { method: "POST", body: payload }),
+ login: (payload) => request("/api/auth/login", { method: "POST", body: payload }),
+ logout: () => request("/api/auth/logout", { method: "POST" }),
mySuggestions: () => request("/api/suggestions/mine"),
createSuggestion: (payload) => request("/api/suggestions", { method: "POST", body: payload }),
diff --git a/wwwroot/styles.css b/wwwroot/styles.css
index 6fcf1a2..df914a7 100644
--- a/wwwroot/styles.css
+++ b/wwwroot/styles.css
@@ -245,6 +245,9 @@ input[type="range"].full-slider::-moz-range-track {
}
.toast.error { background: #dc2626; }
+.auth-card .active { font-weight: 700; }
+.auth-form { margin-top: 8px; }
+
.admin-toggle {
position: fixed;
bottom: 18px;