mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-07 11:30:55 +03:00
dddae8e257
* Adding **user fixtures** for signin * Adds an initializer for the **current logged in user**. The created singleton object is injected into all controllers + routes. It can be used inside routes + controllers with this.get('user'). For simple development the object is instanciated with a userFixture. Once a proper login and api mock is in place, the fixture needs to be removed. * Added **route 'login'** on url '/ghost/ember/signin' * Added authenticated route with an error hook that redirects to the login route, if status 401 (unauthorized) is returned from REST API. * All "secure" routes now extend from authenticated route * Add /ghost/ember to noAuthNeeded routes in middleware
21 lines
532 B
JavaScript
21 lines
532 B
JavaScript
import ajax from 'ghost/utils/ajax';
|
|
import styleBody from 'ghost/mixins/style-body';
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
|
|
var PostsRoute = AuthenticatedRoute.extend(styleBody, {
|
|
classNames: ['manage'],
|
|
|
|
model: function () {
|
|
return ajax('/ghost/api/v0.1/posts').then(function (response) {
|
|
return response.posts;
|
|
});
|
|
},
|
|
|
|
actions: {
|
|
openEditor: function (post) {
|
|
this.transitionTo('editor', post);
|
|
}
|
|
}
|
|
});
|
|
|
|
export default PostsRoute; |