This commit is contained in:
2019-05-01 23:28:57 +00:00
parent b87d43b70d
commit 7ad284cf77
8 changed files with 192 additions and 91 deletions

View File

@@ -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

View File

@@ -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;
}
};