File size: 961 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
30
31
32
33
import page from '@automattic/calypso-router';
import i18n, { useTranslate } from 'i18n-calypso';
import DocumentHead from 'calypso/components/data/document-head';
import AccountComponent, { noticeId as meSettingsNoticeId } from 'calypso/me/account/main';
import { successNotice } from 'calypso/state/notices/actions';

export function account( context, next ) {
	// Update the url and show the notice after a redirect
	if ( context.query && context.query.updated === 'success' ) {
		context.store.dispatch(
			successNotice( i18n.translate( 'Settings saved successfully!' ), {
				displayOnNextPage: true,
				id: meSettingsNoticeId,
			} )
		);
		page.replace( context.pathname );
	}

	const AccountTitle = () => {
		const translate = useTranslate();

		return <DocumentHead title={ translate( 'Account Settings', { textOnly: true } ) } />;
	};

	context.primary = (
		<>
			<AccountTitle />
			<AccountComponent path={ context.path } />
		</>
	);
	next();
}