File size: 596 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import page from '@automattic/calypso-router';
import { createElement } from 'react';
import SecurityMain from 'calypso/my-sites/site-settings/settings-security/main';
import { getSelectedSiteId } from 'calypso/state/ui/selectors';
export function security( context, next ) {
const state = context.store.getState();
const siteId = getSelectedSiteId( state );
// If we have a site ID, render the main component
// Otherwise, redirect to site selection.
if ( siteId ) {
context.primary = createElement( SecurityMain );
return next();
}
page.redirect( '/settings/security' );
return;
}
|