2017-08-22 10:53:26 +03:00
|
|
|
import Controller from '@ember/controller';
|
|
|
|
import {inject as injectService} from '@ember/service';
|
2017-03-08 16:55:35 +03:00
|
|
|
import {task} from 'ember-concurrency';
|
2015-05-26 05:10:50 +03:00
|
|
|
|
2017-03-08 16:55:35 +03:00
|
|
|
export default Controller.extend({
|
2016-06-30 13:21:47 +03:00
|
|
|
notifications: injectService(),
|
2014-07-31 23:36:20 +04:00
|
|
|
|
2017-03-08 16:55:35 +03:00
|
|
|
save: task(function* () {
|
2015-10-28 14:36:45 +03:00
|
|
|
let notifications = this.get('notifications');
|
|
|
|
|
2017-03-08 16:55:35 +03:00
|
|
|
try {
|
|
|
|
return yield this.get('model').save();
|
|
|
|
} catch (error) {
|
2015-10-07 17:44:23 +03:00
|
|
|
notifications.showAPIError(error, {key: 'code-injection.save'});
|
2017-03-08 16:55:35 +03:00
|
|
|
throw error;
|
|
|
|
}
|
2017-05-18 13:48:37 +03:00
|
|
|
}),
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
save() {
|
|
|
|
this.get('save').perform();
|
|
|
|
}
|
|
|
|
}
|
2014-07-31 23:36:20 +04:00
|
|
|
});
|