Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/gossi/ember-command. Integrate your Business Logic with Ember gossi.github.io/ember-command
Something went wrong. Try again.
Command #
Commands as classes can use ember's dependency injection system as much as ember
developers are used to. That's what the Command base class is
for. Here is how we write our command from above with access to the data layer
(an ember service) to fire off a command to the backend:
import { inject as service } from '@ember/service';
import { Command } from 'ember-command';
import DataService from 'super-rentals/services/data';
export default class RequestOfferCommand extends Command {
@service declare data: DataService;
execute(): void {
this.data.sendCommand('super-rentals.recommendations.request-offer', {...});
}
}