mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +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
818 B
JavaScript
32 lines
818 B
JavaScript
import Component from '@glimmer/component';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default class UnarchiveTierModalComponent extends Component {
|
|
@service notifications;
|
|
@service router;
|
|
|
|
get isActive() {
|
|
const {product} = this.args.data;
|
|
return !!product.active;
|
|
}
|
|
|
|
@task({drop: true})
|
|
*unarchiveTask() {
|
|
const {product, onUnarchive} = this.args.data;
|
|
product.active = true;
|
|
|
|
try {
|
|
yield product.save();
|
|
onUnarchive?.();
|
|
return product;
|
|
} catch (error) {
|
|
if (error) {
|
|
this.notifications.showAPIError(error, {key: 'tier.unarchive.failed'});
|
|
}
|
|
} finally {
|
|
this.args.close();
|
|
}
|
|
}
|
|
}
|