2020-06-19 16:14:39 +03:00
|
|
|
import ModalComponent from 'ghost-admin/components/modal-base';
|
|
|
|
import {task} from 'ember-concurrency';
|
|
|
|
|
|
|
|
export default ModalComponent.extend({
|
2020-06-19 20:14:14 +03:00
|
|
|
confirmed: false,
|
|
|
|
response: null,
|
|
|
|
error: null,
|
|
|
|
|
2020-06-19 16:14:39 +03:00
|
|
|
// Allowed actions
|
|
|
|
confirm: () => {},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
confirm() {
|
|
|
|
this.deleteMembersTask.perform();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
deleteMembersTask: task(function* () {
|
|
|
|
try {
|
2020-06-19 20:14:14 +03:00
|
|
|
this.set('response', yield this.confirm());
|
|
|
|
this.set('confirmed', true);
|
|
|
|
} catch (e) {
|
2021-04-08 14:06:27 +03:00
|
|
|
if (e.payload?.errors) {
|
2020-06-19 20:14:14 +03:00
|
|
|
this.set('confirmed', true);
|
|
|
|
this.set('error', e.payload.errors[0].message);
|
|
|
|
}
|
|
|
|
|
|
|
|
throw e;
|
2020-06-19 16:14:39 +03:00
|
|
|
}
|
|
|
|
}).drop()
|
|
|
|
});
|