Download wp-calypso/client/sites/index.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/sites/index.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/sites/index.tsx
-
curl -L -o index.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/sites/index.tsx
1.12 kB
| import page from '@automattic/calypso-router'; | |
| import { makeLayout, render as clientRender, setSelectedSiteIdByOrigin } from 'calypso/controller'; | |
| import { navigation } from 'calypso/my-sites/controller'; | |
| import { getSiteBySlug, getSiteHomeUrl } from 'calypso/state/sites/selectors'; | |
| import { | |
| maybeRemoveCheckoutSuccessNotice, | |
| sanitizeQueryParameters, | |
| sitesDashboard, | |
| } from './controller'; | |
| export default function () { | |
| // Maintain old `/sites/:id` URLs by redirecting them to My Home | |
| page( '/sites/:site', ( context ) => { | |
| const state = context.store.getState(); | |
| const site = getSiteBySlug( state, context.params.site ); | |
| // The site may not be loaded into state yet. | |
| const siteId = site?.ID; | |
| page.redirect( getSiteHomeUrl( state, siteId ) ); | |
| } ); | |
| page( | |
| '/p2s', | |
| maybeRemoveCheckoutSuccessNotice, | |
| sanitizeQueryParameters, | |
| navigation, | |
| setSelectedSiteIdByOrigin, | |
| sitesDashboard, | |
| makeLayout, | |
| clientRender | |
| ); | |
| page( | |
| '/sites', | |
| maybeRemoveCheckoutSuccessNotice, | |
| sanitizeQueryParameters, | |
| navigation, | |
| setSelectedSiteIdByOrigin, | |
| sitesDashboard, | |
| makeLayout, | |
| clientRender | |
| ); | |
| } | |