headers for cors

main
km0 2 years ago
parent b37d5c6d65
commit 7db1193cf7

@ -20,10 +20,12 @@ def makeTree(entries):
def list():
db = get_db()
trees = db.execute('SELECT * FROM trees').fetchall()
response = []
t = []
for tree in trees:
response.append(tree['slug'])
return jsonify(response)
t.append(tree['slug'])
response = jsonify(t)
response.headers.add("Access-Control-Allow-Origin", "*")
return response
@bp.route('tree/<tree>/')
@ -36,7 +38,7 @@ def tree(tree=None):
(tree,)
).fetchall()
response = {
r = {
"id": tree_info['id'],
"slug": tree_info['slug'],
"name": tree_info['name'],
@ -53,7 +55,9 @@ def tree(tree=None):
# insert it in its parent if not NEW
# remove it from the list
response['branches'] = makeTree(branches)
r['branches'] = makeTree(branches)
response = jsonify(r)
response.headers.add("Access-Control-Allow-Origin", "*")
return jsonify(response)
return response

Loading…
Cancel
Save