Commit 61724c6e authored by Willard's avatar Willard

Fix typo in dish_favorite, send user id in token

parent a310ed97
......@@ -93,7 +93,7 @@ def verify_token(token):
@auth.login_required
def get_auth_token():
token = generate_token(g.user)
return jsonify({'token': token.decode('ascii'), 'duration': 600})
return jsonify({'token': token.decode('ascii'), 'duration': 600, 'id': g.user.id})
@auth.error_handler
def unauthorized():
......@@ -109,7 +109,7 @@ def dish_favorite(dish_id):
dish = Dish.query.get(dish_id)
if request.method == 'POST':
favorited = request.form['favorited'] == 'true'
if dish not in g.user.dish_Favorites and favorited:
if dish not in g.user.dish_favorites and favorited:
g.user.dish_favorites.append(dish)
elif dish in g.user.dish_favorites and not favorited:
g.user.dish_favorites.remove(dish)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment