mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-16 20:43:01 +03:00
450095460a
No Issue
23 lines
654 B
JavaScript
23 lines
654 B
JavaScript
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
|
|
|
var PostsIndexRoute = AuthenticatedRoute.extend(loadingIndicator, {
|
|
// redirect to first post subroute unless no posts exist
|
|
beforeModel: function () {
|
|
var self = this;
|
|
|
|
return this.store.find('post', {
|
|
status: 'all',
|
|
staticPages: 'all'
|
|
}).then(function (records) {
|
|
var post = records.get('firstObject');
|
|
|
|
if (post) {
|
|
return self.transitionTo('posts.post', post);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
export default PostsIndexRoute;
|