mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
parent
820459e625
commit
356f9525d8
1 changed files with 8 additions and 1 deletions
|
@ -1,11 +1,18 @@
|
||||||
var SettingsUserRoute = Ember.Route.extend({
|
var SettingsUserRoute = Ember.Route.extend({
|
||||||
model: function (params) {
|
model: function (params) {
|
||||||
|
var self = this;
|
||||||
// TODO: Make custom user adapter that uses /api/users/:slug endpoint
|
// TODO: Make custom user adapter that uses /api/users/:slug endpoint
|
||||||
// return this.store.find('user', { slug: params.slug });
|
// return this.store.find('user', { slug: params.slug });
|
||||||
|
|
||||||
// Instead, get all the users and then find by slug
|
// Instead, get all the users and then find by slug
|
||||||
return this.store.find('user').then(function (result) {
|
return this.store.find('user').then(function (result) {
|
||||||
return result.findBy('slug', params.slug);
|
var user = result.findBy('slug', params.slug);
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return self.transitionTo('error404', 'settings/users/' + params.slug);
|
||||||
|
}
|
||||||
|
|
||||||
|
return user;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue