mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
bd87ee3e2a
refs https://github.com/TryGhost/Team/issues/1734 refs https://github.com/TryGhost/Team/issues/559 refs https://github.com/TryGhost/Ghost/issues/14101 - switches to newer modal patterns ready for later Ember upgrades
30 lines
839 B
JavaScript
30 lines
839 B
JavaScript
import Component from '@glimmer/component';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default class DeleteIntegrationModal extends Component {
|
|
@service notifications;
|
|
@service router;
|
|
|
|
@task({drop: true})
|
|
*deleteIntegrationTask() {
|
|
try {
|
|
const {integration} = this.args.data;
|
|
|
|
if (integration.isDeleted) {
|
|
return true;
|
|
}
|
|
|
|
yield integration.destroyRecord();
|
|
|
|
this.notifications.closeAlerts('integration.delete');
|
|
this.router.transitionTo('settings.integrations');
|
|
return true;
|
|
} catch (error) {
|
|
this.notifications.showAPIError(error, {key: 'integration.delete.failed'});
|
|
} finally {
|
|
this.args.close();
|
|
}
|
|
}
|
|
}
|