Skip to content

Commit

Permalink
gui: add support for calling the API using the DELETE method
Browse files Browse the repository at this point in the history
The v1/DeleteUser api endpoint uses the DELETE method, so we'll need
support for it in the gui code.
  • Loading branch information
jeffmahoney committed Nov 2, 2022
1 parent f1e0cef commit 7147eb3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
18 changes: 9 additions & 9 deletions api/proto/api.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions gui/velociraptor/src/components/core/api-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,24 @@ const href = function(url, params, options) {
return base_path + url + "?" + qs.stringify(params, options);
};

const delete_req = function(url, params, cancel_token) {
return axios({
method: 'delete',
url: api_handlers + url,
params: params,
cancelToken: cancel_token,
headers: {
"X-CSRF-Token": window.CsrfToken,
}
}).then(response=>{
// Update the csrf token.
let token = response.headers["x-csrf-token"];
if (token && token.length > 0) {
window.CsrfToken = token;
}
return response;
}).catch(handle_error);
};

var hooks = [];

Expand All @@ -248,4 +266,6 @@ export default {
hooks: hooks,
base_path: base_path,
href: href,
delete_req: delete_req,
};

0 comments on commit 7147eb3

Please sign in to comment.