Browse Source

add remove endpoint to editor routes

weichen 4 năm trước cách đây
mục cha
commit
c631135ef3
1 tập tin đã thay đổi với 9 bổ sung2 xóa
  1. 9 2
      backstage/editor/routes.py

+ 9 - 2
backstage/editor/routes.py

@@ -1,5 +1,5 @@
-from flask import render_template, Blueprint, request
-
+from flask import render_template, Blueprint, request, redirect, url_for
+import requests
 
 editor_app = Blueprint('editor', __name__)
 
@@ -8,3 +8,10 @@ editor_app = Blueprint('editor', __name__)
 def editor():
     url = request.args.get('url', type=str)
     return render_template('editor.html', title='Type Editor', url=url)
+
+
+@editor_app.route('/backstage/remove', methods=['POST'])
+def remove():
+    url = request.args.get('url', type=str)
+    response = requests.delete('http://127.0.0.1:5000/api/contents?url={}'.format(url))
+    return redirect(url_for('collections.collection_list'))