meilisearch-admin/app/controllers/admin/indexes/item/documents/document/delete.js
2022-09-19 15:36:40 +03:00

24 lines
587 B
JavaScript

import Controller from '@ember/controller';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class AdminIndexesItemDocumentsDocumentDeleteController extends Controller {
@service router;
@service toaster;
@action
delete() {
return this.model.index
.deleteDocument(this.model.document)
.then(this.toaster.taskToast);
}
@action
cancel() {
const newRouteName = this.router.currentRouteName.replace(
/\.(new|edit|delete)$/,
''
);
this.router.transitionTo(newRouteName);
}
}