mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-02 07:43:11 +03:00
8cc4c6c4a1
no issue - since `ember-concurrency@2.0` it's possible to use the standard imports as decorators removing the need for the extra `ember-concurrency-decorators` dependency and imports
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default class ConfirmDeleteThemeComponent extends Component {
|
|
@service ghostPaths;
|
|
@service notifications;
|
|
@service utils;
|
|
|
|
@action
|
|
downloadTheme(event) {
|
|
event.preventDefault();
|
|
this.utils.downloadFile(`${this.ghostPaths.apiRoot}/themes/${this.args.data.theme.name}/download/`);
|
|
}
|
|
|
|
@task
|
|
*deleteThemeTask() {
|
|
try {
|
|
yield this.args.data.theme.destroyRecord();
|
|
// we need to unload from the store here so that uploading another
|
|
// theme with the same "id" doesn't attempt to update the deleted record
|
|
this.args.data.theme.unloadRecord();
|
|
this.args.close();
|
|
return true;
|
|
} catch (error) {
|
|
// TODO: show error in modal rather than generic message
|
|
this.notifications.showAPIError(error);
|
|
}
|
|
}
|
|
}
|