dimanche 29 janvier 2017

How to customize(? or add path to) ember.js Ember Data RESTful URI?

Say, I have the following code:

In app/adapters/instagram.js:

import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({

  urlForQueryRecord(query) {
    if (query.friendscount) {
      delete query.friendscount;
      return `${this._super(...arguments)}/friendscount`;
    }

    return this._super(...arguments);
  }

}

It will go out to http://localhost:20000/instagrams/friendscount to retrieve the data.

How do I make ember.js go out to "http://localhost:20000/socialnetworks/instagrams/friendscount"? (add "socialnetworks" into URI. Note that this "socialnetworks" is before the "instagrams".)




Aucun commentaire:

Enregistrer un commentaire