2014-07-05 14:44:19 -06:00
|
|
|
var NProgressSaveMixin = Ember.Mixin.create({
|
|
|
|
save: function (options) {
|
|
|
|
if (options && options.disableNProgress) {
|
|
|
|
return this._super(options);
|
|
|
|
}
|
2014-10-24 21:09:50 +00:00
|
|
|
|
2014-07-05 14:44:19 -06:00
|
|
|
NProgress.start();
|
2014-10-24 21:09:50 +00:00
|
|
|
|
2014-07-05 14:44:19 -06:00
|
|
|
return this._super(options).then(function (value) {
|
|
|
|
NProgress.done();
|
2014-10-24 21:09:50 +00:00
|
|
|
|
2014-07-05 14:44:19 -06:00
|
|
|
return value;
|
|
|
|
}).catch(function (error) {
|
|
|
|
NProgress.done();
|
2014-10-24 21:09:50 +00:00
|
|
|
|
2014-07-05 14:44:19 -06:00
|
|
|
return Ember.RSVP.reject(error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-10-24 21:09:50 +00:00
|
|
|
export default NProgressSaveMixin;
|