This commit is contained in:
@@ -180,6 +180,14 @@ export default {
|
||||
headers: this.postAuthorizedHeaders()
|
||||
};
|
||||
},
|
||||
fetchRemoveOptions() {
|
||||
/* REMOVE WITH AUTH */
|
||||
return {
|
||||
method: "delete",
|
||||
mode: "cors",
|
||||
headers: this.postAuthorizedHeaders()
|
||||
};
|
||||
},
|
||||
APIUrl(apiPath) {
|
||||
if ("" == store.state.apiUrl) {
|
||||
//construct the api url and store it
|
||||
@@ -292,6 +300,24 @@ export default {
|
||||
handleError("UPSERT", error, route, reject);
|
||||
});
|
||||
});
|
||||
},
|
||||
///////////////////////////////////
|
||||
// DELETE DATA FROM API SERVER
|
||||
//
|
||||
remove(route) {
|
||||
var that = this;
|
||||
return new Promise(function removeDataFromServer(resolve, reject) {
|
||||
fetch(that.APIUrl(route), that.fetchRemoveOptions())
|
||||
.then(that.status)
|
||||
//.then(that.json)
|
||||
.then(response => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch(function handleRemoveError(error) {
|
||||
//fundamental error, can't proceed with this call
|
||||
handleError("DELETE", error, route, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//new functions above here
|
||||
|
||||
@@ -502,5 +502,12 @@ export default {
|
||||
newState.vm.formState.readOnly = newState.readOnly;
|
||||
}
|
||||
});
|
||||
},
|
||||
async confirm(vm) {
|
||||
const res = await vm.$dialog.confirm({
|
||||
text: "Do you really want to exit?",
|
||||
title: "Warning"
|
||||
});
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user