No need to execute a canceled request
I'm currently working on a validation plugin for my models and I'm encountering some weird things with the $send method.
When hooking in the before-save action I can cancel my request using this.$$action.canceled. Though, when I do this, the model still makes a $http request to the server. It would make more sense if the cancel check happens before making the $http request, wouldn't it?
I'm talking about the following lines of code:
this.$response = null;
this.$status = 'pending';
this.$dispatch('before-request', [_options]);
return $http(_options).then(wrapPromise(this, function() {
if(action && action.canceled) {
this.$status = 'canceled';
this.$dispatch('after-request-cancel', []);
return $q.reject(this);
} else {
this.$status = 'ok';
this.$response = this.$last;
this.$dispatch('after-request', [this.$response]);
if(_success) _success.call(this, this.$response);
}
Or is there an other way to cancel requests which I'm totally missing?
+1 I also have this question
+1 on this
I don't know there seems to be some implementation of this but not sure why it is failing