/
githubmirror
/
wp-calypso
Обзор
Документация
Войти
/
githubmirror
/
wp-calypso
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
client/hosting/overview/controller.tsx
40 строк
1 KB
arthur791004
Hosting Config: Redirect to site settings or hosting features depends on the site type (#105077)
06 авг 2025, 15:51
Не верифицирован
06 авг 2025, 15:51
6afa78a
Код
Авторство
О чём код?
import page, { Context as PageJSContext } from '@automattic/calypso-router'; import { removeQueryArgs } from '@wordpress/url'; import i18n from 'i18n-calypso'; import Hosting from 'calypso/hosting/server-settings/main'; import { PanelWithSidebar } from 'calypso/sites/components/panel-sidebar'; import { SettingsSidebar } from 'calypso/sites/settings/controller'; import { successNotice } from 'calypso/state/notices/actions'; export async function hostingConfiguration( context: PageJSContext, next: () => void ) { const { dispatch } = context.store; // Update the url and show the notice after a redirect if ( context.query && context.query.hosting_features === 'activated' ) { dispatch( successNotice( i18n.translate( 'Hosting features activated successfully!' ), { displayOnNextPage: true, } ) ); // Remove query param without triggering a re-render window.history.replaceState( null, '', removeQueryArgs( window.location.href, 'hosting_features' ) ); } context.primary = ( <PanelWithSidebar> <SettingsSidebar /> <div className="hosting-configuration"> <Hosting /> </div> </PanelWithSidebar> ); next(); } export async function redirectToSettingsIfDuplicatedView( context: PageJSContext ) { return page.redirect( `/sites/${ context.params.site_id }/settings` ); }