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