ember.js - Ember data - Multiple namespaces for single model -
i have ember data model named activity.
depending on current route, need call services populate store activities different api namespaces. while current activityadapter looks this:
app.activityadapter = ds.restadapter.extend({ namespace: 'services/activities' });
i want this:
app.activityadapter = ds.restadapter.extend({ if (this.get('currentroute') === "user") { namespace: 'services/users/activities' } else { namespace: 'services/activities' } });
i can't seem find solution this, , best can think of right hack involves creating separate useractivity model has same properties activity model, , specifying separate useractivityadapter.
has else run issue? input appreciated!
do control api on server? if so, change /services/activities
endpoint accept optional userid
query param.
so target same namespace:
get /services/activities
=> returns activitiesget /services/activities?userid=123
=> return activities user123
this common pattern in rest apis. maybe misunderstood problem?
Comments
Post a Comment