summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/main.py9
-rw-r--r--frontend/admin/admin.js6
2 files changed, 9 insertions, 6 deletions
diff --git a/backend/main.py b/backend/main.py
index e529c86..ff6ec38 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -136,6 +136,10 @@ class Status(Enum):
OUTOFSERVICE = 3,
+class PlaintextPasswordData(BaseModel):
+ password: str
+
+
URI_TO_MACHINES = {
"h1-status": [1, None],
"h1-dryer1": [1, 1],
@@ -475,8 +479,9 @@ def notif_subscribe(data: notif.PushSubscriptionData, response: fastapi.Response
# --- admin login
@app.post("/admin_login", response_class=PlainTextResponse)
-def admin_login(data: str, response: fastapi.Response):
- print(data)
+def admin_login(data: PlaintextPasswordData, response: fastapi.Response):
+ print(data.password)
+ return data.password
# --- override each machine status
diff --git a/frontend/admin/admin.js b/frontend/admin/admin.js
index 5a194c9..74d60b4 100644
--- a/frontend/admin/admin.js
+++ b/frontend/admin/admin.js
@@ -7,10 +7,8 @@ async function login() {
method: "POST",
credentials: "include",
headers: {
- "Content-Type": "text/plain"
+ "Content-Type": "application/json"
},
- body: field.value,
+ body: {"password": field.value},
});
-
- alert("loggin' in");
}