File size: 784 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import page from '@automattic/calypso-router';
import { makeLayout, render as clientRender, redirectIfDuplicatedView } from 'calypso/controller';
import { getSiteFragment } from 'calypso/lib/route';
import { navigation, siteSelection } from 'calypso/my-sites/controller';
import postsController from './controller';
export default function () {
page(
'/posts/:author(my)?/:status(published|drafts|scheduled|trashed)?/:domain?',
siteSelection,
redirectIfDuplicatedView( 'edit.php' ),
navigation,
postsController.posts,
makeLayout,
clientRender
);
page( '/posts/*', ( { path } ) => {
const siteFragment = getSiteFragment( path );
if ( siteFragment ) {
return page.redirect( `/posts/my/${ siteFragment }` );
}
return page.redirect( '/posts/my' );
} );
}
|