Fix dashboard -> http functions over view page not working on refresh (was sending html partial for htmx)
This commit is contained in:
8
app.py
8
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user