File size: 762 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
29
import config from '@automattic/calypso-config';
import { getLanguageRouteParam } from '@automattic/i18n-utils';
import { makeLayout, setLocaleMiddleware } from 'calypso/controller';
import webRouter from './index.web';
import redirectLoggedIn from './redirect-logged-in';
import { setMetaTags } from './ssr';

/**
 * Re-exports
 */
export { LOGIN_SECTION_DEFINITION } from './index.web';

export default ( router ) => {
	if ( config.isEnabled( 'login/magic-login' ) ) {
		const lang = getLanguageRouteParam();

		// Only do the basics for layout on the server-side
		router(
			[ `/log-in/link/use/${ lang }`, `/log-in/link/jetpack/use/${ lang }` ],
			setLocaleMiddleware(),
			redirectLoggedIn,
			setMetaTags,
			makeLayout
		);
	}

	webRouter( router );
};