mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
f654b24486
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
29 lines
748 B
JavaScript
29 lines
748 B
JavaScript
import Component from '@glimmer/component';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default class DeleteWebhookModal extends Component {
|
|
@service notifications;
|
|
@service router;
|
|
|
|
@task({drop: true})
|
|
*deleteWebhookTask() {
|
|
try {
|
|
const {webhook} = this.args.data;
|
|
|
|
if (webhook.isDeleted) {
|
|
return true;
|
|
}
|
|
|
|
yield webhook.destroyRecord();
|
|
|
|
this.notifications.closeAlerts('webhook.delete');
|
|
return true;
|
|
} catch (error) {
|
|
this.notifications.showAPIError(error, {key: 'webhook.delete.failed'});
|
|
} finally {
|
|
this.args.close();
|
|
}
|
|
}
|
|
}
|