Skip to content

Commit 61af940

Browse files
author
Vianpyro
committed
Use request JSON
1 parent e046e87 commit 61af940

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

routes/interactions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@jwt_required()
1111
def favorite_recipe():
1212
current_user = get_jwt_identity()
13-
recipe_id = request.args.get("recipe_id")
13+
recipe_id = request.json.get("recipe_id")
1414

1515
db = get_db_connection()
1616
with db.cursor() as cursor:
@@ -25,7 +25,7 @@ def favorite_recipe():
2525
@jwt_required()
2626
def unfavorite_recipe():
2727
current_user = get_jwt_identity()
28-
recipe_id = request.args.get("recipe_id")
28+
recipe_id = request.json.get("recipe_id")
2929

3030
db = get_db_connection()
3131
with db.cursor() as cursor:
@@ -40,7 +40,7 @@ def unfavorite_recipe():
4040
@jwt_required()
4141
def rate_recipe():
4242
current_user = get_jwt_identity()
43-
recipe_id = request.args.get("recipe_id")
43+
recipe_id = request.json.get("recipe_id")
4444
rating = request.json.get("rating")
4545

4646
db = get_db_connection()
@@ -56,7 +56,7 @@ def rate_recipe():
5656
@jwt_required()
5757
def comment_recipe():
5858
current_user = get_jwt_identity()
59-
recipe_id = request.args.get("recipe_id")
59+
recipe_id = request.json.get("recipe_id")
6060
comment = request.json.get("comment")
6161

6262
db = get_db_connection()
@@ -71,7 +71,7 @@ def comment_recipe():
7171
@interactions_blueprint.route("/comment", methods=["DELETE"])
7272
@jwt_required()
7373
def delete_comment():
74-
comment_id = request.args.get("comment_id")
74+
comment_id = request.json.get("comment_id")
7575

7676
# TODO: Load the comment first to verify that the user is the author
7777

@@ -88,7 +88,7 @@ def delete_comment():
8888
@jwt_required()
8989
def like_comment():
9090
current_user = get_jwt_identity()
91-
comment_id = request.args.get("comment_id")
91+
comment_id = request.json.get("comment_id")
9292

9393
db = get_db_connection()
9494
with db.cursor() as cursor:
@@ -103,7 +103,7 @@ def like_comment():
103103
@jwt_required()
104104
def unlike_comment():
105105
current_user = get_jwt_identity()
106-
comment_id = request.args.get("comment_id")
106+
comment_id = request.json.get("comment_id")
107107

108108
db = get_db_connection()
109109
with db.cursor() as cursor:

0 commit comments

Comments
 (0)