2018-09-25 16:28:26 +00:00
|
|
|
import { set } from '@ember/object';
|
|
|
|
import Route from '@ember/routing/route';
|
2018-04-03 14:16:57 +00:00
|
|
|
import DS from 'ember-data';
|
2019-06-21 15:18:26 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Route.extend({
|
2019-06-21 15:18:26 +00:00
|
|
|
pathHelp: service('path-help'),
|
2018-04-03 14:16:57 +00:00
|
|
|
model(params) {
|
|
|
|
const { path } = params;
|
|
|
|
return this.store.findAll('auth-method').then(modelArray => {
|
|
|
|
const model = modelArray.findBy('id', path);
|
|
|
|
if (!model) {
|
|
|
|
const error = new DS.AdapterError();
|
2018-09-25 16:28:26 +00:00
|
|
|
set(error, 'httpStatus', 404);
|
2018-04-03 14:16:57 +00:00
|
|
|
throw error;
|
|
|
|
}
|
2019-06-21 15:18:26 +00:00
|
|
|
return this.pathHelp.getPaths(model.apiPath, path).then(paths => {
|
|
|
|
model.set('paths', paths);
|
|
|
|
return model;
|
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|