Skip to content

Commit

Permalink
added flash messages after post deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
DogukanUrker committed Jan 17, 2024
1 parent fed2451 commit 18ab2b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions routes/adminPanelPosts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from helpers import (
flash,
sqlite3,
session,
request,
Expand Down Expand Up @@ -28,6 +29,7 @@ def adminPanelPosts():
if request.method == "POST":
if "postDeleteButton" in request.form:
deletePost(request.form["postID"])
flash("post deleted", "error")
match role == "admin":
case True:
connection = sqlite3.connect(DB_POSTS_ROOT)
Expand Down
1 change: 1 addition & 0 deletions routes/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def dashboard(userName):
if request.method == "POST":
if "postDeleteButton" in request.form:
deletePost(request.form["postID"])
flash("post deleted", "error")
return (
redirect(
url_for("dashboard.dashboard", userName=userName)
Expand Down
1 change: 1 addition & 0 deletions routes/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def post(postID):
if request.method == "POST":
if "postDeleteButton" in request.form:
deletePost(postID)
flash("post deleted", "error")
return redirect(f"/")
elif "commentDeleteButton" in request.form:
deleteComment(request.form["commentID"])
Expand Down

0 comments on commit 18ab2b3

Please sign in to comment.