From 7a7db97914ba011f398704fc49891ccfd94e1d6d Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 13 Sep 2020 00:39:25 +1000 Subject: [PATCH] add inventreeDelete ajax function --- .../InvenTree/static/script/inventree/api.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/InvenTree/InvenTree/static/script/inventree/api.js b/InvenTree/InvenTree/static/script/inventree/api.js index 0a3b8d9374..52aba80ef5 100644 --- a/InvenTree/InvenTree/static/script/inventree/api.js +++ b/InvenTree/InvenTree/static/script/inventree/api.js @@ -108,6 +108,25 @@ function inventreePut(url, data={}, options={}) { if (options.error) { options.error(xhr, ajaxOptions, thrownError); } + }, + complete: function(xhr, status) { + if (options.complete) { + options.complete(xhr, status); + } } }); } + + +function inventreeDelete(url, options={}) { + /* + * Delete a record + */ + + options = options || {}; + + options.method = 'DELETE'; + + inventreePut(url, {}, options); + +} \ No newline at end of file