summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/main.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/backend/main.py b/backend/main.py
index 5f460e4..8dc6470 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -193,9 +193,6 @@ def reminder_timer_finished(timer_id):
cursor.execute("SELECT * FROM timers WHERE timer_id = ?", (timer_id,))
out = cursor.fetchall()
print(out)
-
- for row in out:
- machine_status[row[RowIndices.BLOCK] - 1][row[RowIndices.MACHINE] - 1] = Status.FINISHED.name
scheduler.add_job(final_timer_finished, 'date', run_date=out[0][RowIndices.END_TIME], id=str(timer_id), args=[timer_id])
@@ -455,6 +452,11 @@ def uri_to_information(data: InformationRequestData, response: fastapi.Response,
# --- subscribe
@app.post("/notifsubscribe", response_class=PlainTextResponse)
def notif_subscribe(data: notif.PushSubscriptionData, response: fastapi.Response):
- endpoint = notif.subscribe(data)
- response.set_cookie(key="subscription_endpoint", value=endpoint, max_age=COOKIE_MAX_AGE, domain="laundryweb.altafcreator.com", samesite="none", secure=True, path="/")
- return "do i need to return something perhaps"
+ try:
+ endpoint = notif.subscribe(data)
+ response.set_cookie(key="subscription_endpoint", value=endpoint, max_age=COOKIE_MAX_AGE, domain="laundryweb.altafcreator.com", samesite="none", secure=True, path="/")
+ response.status_code = fastapi.status.HTTP_200_OK
+ return "subscription saved."
+ except Exception as err:
+ response.status_code = fastapi.status.HTTP_500_INTERNAL_SERVER_ERROR
+ return f"error, failed to save subscription {err}"