Re-implement deactivate with HTTP DELETE
This commit is contained in:
parent
466ce50e3c
commit
da24d23eb7
|
@ -74,6 +74,17 @@ def source_feed(source_name):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.delete("/item/<string:source_name>/<string:item_id>")
|
||||||
|
def deactivate(source_name, item_id):
|
||||||
|
source = LocalSource(intake_data_dir(), source_name)
|
||||||
|
item = source.get_item(item_id)
|
||||||
|
if item["active"]:
|
||||||
|
print(f"Deactivating {source_name}/{item_id}")
|
||||||
|
item["active"] = False
|
||||||
|
source.save_item(item)
|
||||||
|
return jsonify({"active": item["active"]})
|
||||||
|
|
||||||
|
|
||||||
def wsgi():
|
def wsgi():
|
||||||
# init_default_logging()
|
# init_default_logging()
|
||||||
return app
|
return app
|
||||||
|
|
|
@ -60,12 +60,8 @@ table.feed-control td {
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
var deactivate = function (source, itemid) {
|
var deactivate = function (source, itemid) {
|
||||||
fetch('/deactivate/', {
|
fetch(`/item/${source}/${itemid}`, {
|
||||||
method: 'POST',
|
method: 'DELETE',
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({source: source, itemid: itemid}),
|
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
|
|
Loading…
Reference in New Issue