Ghost/ghost/admin/app/controllers/settings/code-injection.js

27 lines
640 B
JavaScript

import Controller from '@ember/controller';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency';
export default class CodeInjectionController extends Controller {
@service notifications;
@service settings;
@action
save() {
this.saveTask.perform();
}
@task
*saveTask() {
let notifications = this.notifications;
try {
return yield this.settings.save();
} catch (error) {
notifications.showAPIError(error, {key: 'code-injection.save'});
throw error;
}
}
}