2018-04-03 14:16:57 +00:00
|
|
|
import Ember from 'ember';
|
2018-04-05 21:08:18 +00:00
|
|
|
import DS from 'ember-data';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
const MODEL_FROM_PARAM = {
|
|
|
|
entities: 'entity',
|
|
|
|
groups: 'group',
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Ember.Route.extend({
|
|
|
|
model(params) {
|
|
|
|
let model = MODEL_FROM_PARAM[params.item_type];
|
2018-04-05 21:08:18 +00:00
|
|
|
if (!model) {
|
|
|
|
const error = new DS.AdapterError();
|
|
|
|
Ember.set(error, 'httpStatus', 404);
|
|
|
|
throw error;
|
|
|
|
}
|
2018-04-03 14:16:57 +00:00
|
|
|
return model;
|
|
|
|
},
|
|
|
|
});
|