diff --git a/app.py b/app.py index e7b97c8..0df8984 100644 --- a/app.py +++ b/app.py @@ -102,7 +102,7 @@ def create_http_function(): return render_template("dashboard/http_functions.html", http_functions=http_functions) except Exception as e: print(e) - return render_template("dashboard/http_functions/new.html", name=name, script=script_content) + return { "status": "error", "message": str(e) } @ app.route("/dashboard/http_functions/edit_form", methods=["GET"]) def get_http_function_edit_form(): @@ -122,10 +122,10 @@ def edit_http_function(): environment_info = json.dumps(eval(request.json.get('environment_info'))) db.edit_http_function(name, script_content, environment_info) - return render_template("dashboard/http_functions/edit.html", name=name, script=script_content, environment_info=environment_info) + return { "status": "success", "message": f'{name} updated' } except Exception as e: print(e) - return render_template("dashboard/http_functions/edit.html", name=name, script=script_content) + return { "status": "error", "message": str(e) } @ app.route("/dashboard/http_functions/delete", methods=["DELETE"]) def delete_http_function(): @@ -137,7 +137,7 @@ def delete_http_function(): http_functions = create_http_functions_view_model(http_functions) return render_template("dashboard/http_functions.html", http_functions=http_functions) except Exception as e: - return jsonify({'error': str(e)}), 500 + return jsonify({"status": 'error', "message": str(e)}), 500 @ app.route("/dashboard/timer_functions", methods=["GET"]) def dashboard_timer_functions(): diff --git a/templates/base.html b/templates/base.html index d159fab..b083dce 100644 --- a/templates/base.html +++ b/templates/base.html @@ -28,5 +28,33 @@ {% block content %} {% endblock %} + +
+ +