2022-09-09 17:32:34 +03:00
|
|
|
import Controller from '@ember/controller';
|
2022-02-01 12:34:03 +03:00
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
2020-05-11 13:37:35 +03:00
|
|
|
import {task} from 'ember-concurrency';
|
2015-05-26 05:10:50 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
export default class CodeInjectionController extends Controller {
|
2022-02-01 20:03:45 +03:00
|
|
|
@service notifications;
|
|
|
|
@service settings;
|
2017-10-31 18:27:25 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@action
|
|
|
|
save() {
|
|
|
|
this.saveTask.perform();
|
|
|
|
}
|
2017-10-31 18:27:25 +03:00
|
|
|
|
2022-09-09 17:32:34 +03:00
|
|
|
@task
|
|
|
|
*saveTask() {
|
2019-03-06 16:53:54 +03:00
|
|
|
let notifications = this.notifications;
|
2018-01-11 20:43:23 +03:00
|
|
|
|
|
|
|
try {
|
2019-03-06 16:53:54 +03:00
|
|
|
return yield this.settings.save();
|
2018-01-11 20:43:23 +03:00
|
|
|
} catch (error) {
|
|
|
|
notifications.showAPIError(error, {key: 'code-injection.save'});
|
|
|
|
throw error;
|
|
|
|
}
|
2022-09-09 17:32:34 +03:00
|
|
|
}
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|