Imagine we have an app that allows a user to collect cards and make decks of their cards.
Also, imagine we have in router:
this.route('cards');
this.route('decks', function() {
this.route('deck', {path: ':deck_name'});
});
And two API endpoints:
GET /cards
— to query all cards controlled by a userGET /decks/:deck_name/cards
— to query all cards in the deck with certaindeck_name
controlled by a user
We have a model of card
and want to make different requests depending on the current route (to the first endpoint for our app's /cards
route, and to second for /decks/:deck_name
route).
How to write an adapter for card
model to query the right endpoint depending on the route?
We use Ember v2.18.
Aucun commentaire:
Enregistrer un commentaire