2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2014-07-06 00:44:19 +04:00
|
|
|
var NProgressSaveMixin = Ember.Mixin.create({
|
|
|
|
save: function (options) {
|
|
|
|
if (options && options.disableNProgress) {
|
|
|
|
return this._super(options);
|
|
|
|
}
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-07-06 00:44:19 +04:00
|
|
|
NProgress.start();
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-07-06 00:44:19 +04:00
|
|
|
return this._super(options).then(function (value) {
|
|
|
|
NProgress.done();
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-07-06 00:44:19 +04:00
|
|
|
return value;
|
|
|
|
}).catch(function (error) {
|
|
|
|
NProgress.done();
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-07-06 00:44:19 +04:00
|
|
|
return Ember.RSVP.reject(error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
export default NProgressSaveMixin;
|