From 485bc122aeccc7d583b68a36921557d16ec8edae Mon Sep 17 00:00:00 2001 From: DewGew Date: Mon, 5 Feb 2024 14:14:42 +0100 Subject: [PATCH] Update api.py --- modules/api.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/api.py b/modules/api.py index 40f7bb5..12acea6 100644 --- a/modules/api.py +++ b/modules/api.py @@ -98,7 +98,7 @@ def gateway(): else: getDomoticzDevices(flask_login.current_user.username) flash("Devices synced with domoticz") - return "Devices synced with domoticz", 200 + result = '{"title": "RequestedSync", "status": "OK"}' elif custom == "restart": if dbuser.admin: @@ -113,13 +113,13 @@ def gateway(): elif custom == "server_settings": if dbuser.admin: modifyServerSettings(request) - return "Server settings saved", 200 + result = '{"title": "ServerSettingsChanged", "status": "OK"}' elif custom == "user_settings": modifyUserSettings(flask_login.current_user.username, request) - return "User settings saved", 200 - + result = '{"title": "UserSettingsChanged", "status": "OK"}' + elif custom == "removeuser": if dbuser.admin: userToRemove = request.args.get('user', '') @@ -131,13 +131,13 @@ def gateway(): remove_user(userToRemove) logger.info("User " + userToRemove + " is deleted") - return "User removed", 200 + result = '{"title": "UserRemoved", "status": "OK"}' elif '?type' in requestedUrl[1]: result = queryDomoticz(flask_login.current_user.username, requestedUrl[1]) try: - return json.loads(result) + return json.loads(result), 200 except Exception: - return "No results returned", 404 + return {"title": "No results returned", "status": "ERR"}, 404