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():
|
||||
# init_default_logging()
|
||||
return app
|
||||
|
@ -60,12 +60,8 @@ table.feed-control td {
|
||||
</style>
|
||||
<script>
|
||||
var deactivate = function (source, itemid) {
|
||||
fetch('/deactivate/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
body: JSON.stringify({source: source, itemid: itemid}),
|
||||
fetch(`/item/${source}/${itemid}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(function (data) {
|
||||
|
Loading…
Reference in New Issue
Block a user