Allow to delete npcs
This commit is contained in:
parent
c330253306
commit
3c8f9a1ada
@ -162,4 +162,12 @@ def set_npc():
|
||||
|
||||
db.session.commit()
|
||||
|
||||
return {"error": 0}
|
||||
return {"error": 0}
|
||||
|
||||
@routes_api_admin.route("/deleteNpc", methods=["GET", "POST"])
|
||||
@require_admin(api=True)
|
||||
def delete_npc():
|
||||
input_npc_id = flask.request.json["npc_id"]
|
||||
db.session.execute(delete(Npc).where(Npc.NPC_ID==input_npc_id))
|
||||
db.session.commit()
|
||||
return {}
|
@ -112,3 +112,8 @@ function saveFormNpc(){
|
||||
makeAPIRequest("admin/setNpc", {"npc": data, "lang": "FR"}, {"content": "json"})
|
||||
}
|
||||
|
||||
async function deleteNpc(){
|
||||
let npc_id = npc.querySelector("#npc_id").value;
|
||||
await makeAPIRequest("admin/deleteNpc", {"npc_id": npc_id, "lang": "FR"}, {"content": "json"});
|
||||
document.location = "/admin";
|
||||
}
|
@ -31,5 +31,6 @@
|
||||
</section>
|
||||
|
||||
<button onclick="saveFormNpc()">Save changes</button>
|
||||
<button onclick="deleteNpc()">Delete Npc</button>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user