I'm working with EmberJS version 2.14.2 for frontend and I have Rails API backend. I want to get some data from backend but auto-generated url is different from my API endpoint.
the difference is: emberJS generates /admins/api/v1/domains but my endpoint is actually /admins/api/v1/domains.json
how can I achive this in EmberJS? how can i define a totally different endpoint for some models?
my adapter:
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
host: 'http://localhost:4000',
namespace: 'admins/api/v1',
session: Ember.inject.service('session'),
headers: Ember.computed('session.access_token', function() {
return {
'Authorization': "Bearer " + this.get('session.access_token')
};
})
});
my model:
import DS from 'ember-data';
export default DS.Model.extend({
host: DS.attr(),
layout: DS.attr(),
token: DS.attr(),
created_at: DS.attr(),
updated_at: DS.attr()
});
Is it possible to define a custom endpoint in EmberJS? I really checked the documentation and there is nothing there.
Plz halp
Aucun commentaire:
Enregistrer un commentaire