This commit is contained in:
2020-06-19 22:15:32 +00:00
parent bfcae2a750
commit ab549628e0
2 changed files with 124 additions and 103 deletions

View File

@@ -423,6 +423,21 @@ export default {
///////////////////////////////////
// GET DATA FROM API SERVER
//
async getEx(route) {
try {
let that = this;
let r = await fetch(that.APIUrl(route), that.fetchGetOptions());
that.statusEx(r);
r = await that.extractBodyEx(r);
return r;
} catch (error) {
//fundamental error, can't proceed with this call
handleError("GET", error, route, reject);
}
},
///////////////////////////////////
// GET DATA FROM API SERVER
//
get(route) {
let that = this;
return new Promise(function getDataFromServer(resolve, reject) {
@@ -489,6 +504,22 @@ export default {
///////////////////////////////////
// DELETE DATA FROM API SERVER
//
async removeEx(route) {
let that = this;
try {
let r = await fetch(that.APIUrl(route), that.fetchRemoveOptions());
that.statusEx(r);
//delete will return a body if there is an error of some kind with the request
r = await that.extractBodyEx(r);
return r;
} catch (error) {
//fundamental error, can't proceed with this call
handleError("DELETE", error, route);
}
},
///////////////////////////////////
// DELETE DATA FROM API SERVER
//
remove(route) {
let that = this;
return new Promise(function removeDataFromServer(resolve, reject) {