Reject any request if no route is given
All checks were successful
the build was successful

This commit is contained in:
konrad 2019-02-22 21:21:55 +01:00
parent f98af40bd6
commit 210a9eee74
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -145,6 +145,9 @@ export default class AbstractService {
* @returns {Q.Promise<any>}
*/
get(model, params = {}) {
if (this.paths.get === '') {
return Promise.reject({message: 'This model is not able to get data.'})
}
// We later will be able to cancel the loading indicator using this.
const cancel = this.setLoading()
@ -168,6 +171,10 @@ export default class AbstractService {
* @returns {Promise<any | never>}
*/
create(model) {
if (this.paths.create === '') {
return Promise.reject({message: 'This model is not able to create data.'})
}
const cancel = this.setLoading()
// Finally make the request and get our data.
@ -189,6 +196,9 @@ export default class AbstractService {
* @returns {Q.Promise<any>}
*/
update(model) {
if (this.paths.update === '') {
return Promise.reject({message: 'This model is not able to update data.'})
}
const cancel = this.setLoading()
// Finally make the request and get our data.