Bug 37762: VueJS framework: Add patch to http-client.js
Signed-off-by: Jason Robb <jrobb@sekls.org> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
9e420632e7
commit
675dd1cac0
|
|
@ -183,6 +183,27 @@ class HttpClient {
|
|||
);
|
||||
}
|
||||
|
||||
patch(params = {}) {
|
||||
const body = params.body
|
||||
? typeof params.body === "string"
|
||||
? params.body
|
||||
: JSON.stringify(params.body)
|
||||
: undefined;
|
||||
let csrf_token = { "CSRF-TOKEN": this.csrf_token };
|
||||
let headers = { ...csrf_token, ...params.headers };
|
||||
return this._fetchJSON(
|
||||
params.endpoint,
|
||||
headers,
|
||||
{
|
||||
...params.options,
|
||||
body,
|
||||
method: "PATCH",
|
||||
},
|
||||
params.return_response ?? false,
|
||||
params.mark_submitting ?? true
|
||||
);
|
||||
}
|
||||
|
||||
delete(params = {}) {
|
||||
let csrf_token = { "CSRF-TOKEN": this.csrf_token };
|
||||
let headers = { ...csrf_token, ...params.headers };
|
||||
|
|
|
|||
Loading…
Reference in New Issue