2018-10-19 19:37:27 +03:00
|
|
|
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();
|
2021-01-28 18:25:21 +03:00
|
|
|
this.router.transitionTo('integrations');
|
2018-10-19 19:37:27 +03:00
|
|
|
} catch (error) {
|
|
|
|
this.notifications.showAPIError(error, {key: 'integration.delete.failed'});
|
|
|
|
} finally {
|
|
|
|
this.send('closeModal');
|
|
|
|
}
|
|
|
|
}).drop()
|
|
|
|
});
|