mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
5bbdad38a5
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
873 B
JavaScript
29 lines
873 B
JavaScript
import Component from '@glimmer/component';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default class DeleteAllContentModal extends Component {
|
|
@service ajax;
|
|
@service ghostPaths;
|
|
@service notifications;
|
|
@service router;
|
|
@service store;
|
|
|
|
@task({drop: true})
|
|
*deleteAllTask() {
|
|
try {
|
|
const deleteUrl = this.ghostPaths.url.api('db');
|
|
yield this.ajax.del(deleteUrl);
|
|
|
|
this.store.unloadAll('post');
|
|
this.store.unloadAll('tag');
|
|
|
|
this.notifications.showAlert('All content deleted from database.', {type: 'success', key: 'all-content.delete.success'});
|
|
} catch (error) {
|
|
this.notifications.showAPIError(error, {key: 'all-content.delete'});
|
|
} finally {
|
|
this.args.close();
|
|
}
|
|
}
|
|
}
|