get und post in der api
This commit is contained in:
parent
6914a75f6c
commit
1a4b38dfe2
1 changed files with 10 additions and 4 deletions
|
@ -306,11 +306,14 @@ def create_app(test_config=None):
|
|||
leave_room(session[id])
|
||||
|
||||
#api
|
||||
@app.route("/api/change", methods=['POST'])
|
||||
@app.route("/api/change", methods=['GET', 'POST'])
|
||||
def api_change():
|
||||
db = get_db()
|
||||
c = db.cursor()
|
||||
try:
|
||||
userid = request.form["id"]
|
||||
except:
|
||||
userid = request.args.get("id")
|
||||
c.execute("SELECT * FROM users WHERE id=?", [userid])
|
||||
user_list = c.fetchall()
|
||||
if user_list != []:
|
||||
|
@ -330,12 +333,15 @@ def create_app(test_config=None):
|
|||
return make_response(json.dumps({"mode":"error","error":"043"}))
|
||||
|
||||
|
||||
@app.route("/api/tag_id", methods=['GET'])
|
||||
@app.route("/api/tag_id", methods=['GET', 'POST'])
|
||||
def get_id():
|
||||
global finished
|
||||
global message
|
||||
db = get_db()
|
||||
c = db.cursor()
|
||||
try:
|
||||
tag_id = request.form["id"]
|
||||
except:
|
||||
tag_id = request.args.get("id")
|
||||
c.execute(f"SELECT * FROM tags WHERE tagid=?", [tag_id])
|
||||
|
||||
|
|
Loading…
Reference in a new issue