diff --git a/app.py b/app.py index 9c5b636..349de06 100644 --- a/app.py +++ b/app.py @@ -110,8 +110,11 @@ def dashboard_http_functions(): user_id = current_user.id http_functions = db.get_http_functions_for_user(user_id) http_functions = create_http_functions_view_model(http_functions) + if htmx: + return render_block(app.jinja_env, "dashboard/http_functions/overview.html", "page", http_functions=http_functions) return render_template("dashboard/http_functions/overview.html", http_functions=http_functions) + @ app.route("/dashboard/http_functions/add_form", methods=["GET"]) @login_required def get_http_function_add_form(): @@ -137,7 +140,7 @@ def create_http_function(): http_functions = db.get_http_functions_for_user(user_id) http_functions = create_http_functions_view_model(http_functions) - return render_template("dashboard/http_functions/overview.html", http_functions=http_functions), 200, {"HX-Push-Url": url_for('dashboard_http_functions')} + return render_block(app.jinja_env, "dashboard/http_functions/overview.html", "page", http_functions=http_functions), 200, {"HX-Push-Url": url_for('dashboard_http_functions')} except Exception as e: print(e) return { "status": "error", "message": str(e) } @@ -184,12 +187,11 @@ def edit_http_function(function_id): def delete_http_function(function_id): try: user_id = current_user.id - name = request.args.get('name') db.delete_http_function(user_id, function_id) http_functions = db.get_http_functions_for_user(user_id) http_functions = create_http_functions_view_model(http_functions) - return render_template("dashboard/http_functions/overview.html", http_functions=http_functions), 200, {"HX-Push-Url": url_for('dashboard_http_functions')} + return render_block(app.jinja_env, "dashboard/http_functions/overview.html", "page", http_functions=http_functions), 200, {"HX-Push-Url": url_for('dashboard_http_functions')} except Exception as e: return jsonify({"status": 'error', "message": str(e)}), 500 diff --git a/templates/dashboard/http_functions/overview.html b/templates/dashboard/http_functions/overview.html index 623b09a..3130e89 100644 --- a/templates/dashboard/http_functions/overview.html +++ b/templates/dashboard/http_functions/overview.html @@ -1,3 +1,7 @@ +{% extends 'dashboard.html' %} + +{% block page %} +