diff --git a/Website/__init__.py b/Website/__init__.py index 5b1726e..34dabbc 100644 --- a/Website/__init__.py +++ b/Website/__init__.py @@ -306,11 +306,11 @@ def create_app(test_config=None): leave_room(session[id]) #api - @app.route("/api/change", methods=['GET']) + @app.route("/api/change", methods=['POST']) def api_change(): db = get_db() c = db.cursor() - userid = request.args.get("id") + userid = request.form["id"] c.execute("SELECT * FROM users WHERE id=?", [userid]) user_list = c.fetchall() if user_list != []: @@ -318,7 +318,7 @@ def create_app(test_config=None): try: change = int(request.args.get("change")) except: - change = -1 + change = -1.5 c.execute(f"UPDATE users SET balance = balance + {change*100} WHERE id={user[0]}") db.commit() c.execute(f"SELECT * FROM users WHERE id = {userid}") @@ -393,7 +393,7 @@ def create_app(test_config=None): user = c.fetchone() log(type="balance", userid=user[0], before=balance_old, after=user[2]) socketio.emit("update", "update") - return make_response(json.dumps({"mode":"balance", "username":user[1], "balance":user[2]})) + return make_response(json.dumps({"mode":"balance", "username":user[1], "balance":user[2]/100})) else: return make_response(json.dumps({"mode":"error", "error":"043"})) socketio.emit("update", "update")