meilisearch-admin/app/controllers/admin/indexes/item/documents/document/delete.js
2022-09-15 14:05:51 +03:00

24 lines
585 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 toasts;
@action
delete() {
return this.model.index
.deleteDocument(this.model.document)
.then(this.toasts.taskToast);
}
@action
cancel() {
const newRouteName = this.router.currentRouteName.replace(
/\.(new|edit|delete)$/,
''
);
this.router.transitionTo(newRouteName);
}
}