1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/components/modal-delete-integration.js
Fabien O'Carroll 11ec0835f6 Added ability to delete integrations (#1057)
no issue
- adds delete integration modal, and delete button on the integration page to trigger it
2018-10-19 17:37:27 +01:00

26 lines
777 B
JavaScript

import ModalComponent from 'ghost-admin/components/modal-base';
import {alias} from '@ember/object/computed';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency';
export default ModalComponent.extend({
router: service(),
notifications: service(),
integration: alias('model'),
actions: {
confirm() {
this.deleteIntegration.perform();
}
},
deleteIntegration: task(function* () {
try {
yield this.confirm();
this.router.transitionTo('settings.integrations');
} catch (error) {
this.notifications.showAPIError(error, {key: 'integration.delete.failed'});
} finally {
this.send('closeModal');
}
}).drop()
});