mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 17:59:57 +08:00
4cdf37bedb
* init form * first demo * add normal login * add style * webit * support nest errors * beauti form errors * use onReset * modal demo * add list demo * match key of errors logic * date demo * customize component * moving style * add status style * without form create * add demos * add inline style * clean up legacy * fix drawer demo * mention * fix edit-row * editable table cell * update mentions demo * fix some test case * fix upload test * fix lint * part of doc * fix ts * doc update * rm react 15 * rm config * enhance test coverage * clean up * fix FormItem context pass logic * add more demo * en to build * update demo * update demo & snapshot * more doc * update list doc * update doc * update demo to display condition render * update snapshot * add provider doc * support configProvider * more doc about validateMessages * more description * more and more doc * fix typo * en doc * Form.List doc * m v3 -> v4 * add skip
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import collect from 'bisheng/collect';
|
|
import MainContent from './MainContent';
|
|
import * as utils from '../utils';
|
|
|
|
function isChangelog(pathname) {
|
|
return pathname.indexOf('changelog') >= 0;
|
|
}
|
|
|
|
export default collect(async nextProps => {
|
|
const { pathname } = nextProps.location;
|
|
const pageDataPath = pathname.replace('-cn', '').split('/');
|
|
const pageData = isChangelog(pathname)
|
|
? nextProps.data.changelog.CHANGELOG
|
|
: nextProps.utils.get(nextProps.data, pageDataPath);
|
|
if (!pageData) {
|
|
throw 404; // eslint-disable-line no-throw-literal
|
|
}
|
|
|
|
const locale = utils.isZhCN(pathname) ? 'zh-CN' : 'en-US';
|
|
const pageDataPromise =
|
|
typeof pageData === 'function'
|
|
? pageData()
|
|
: (pageData[locale] || pageData.index[locale] || pageData.index)();
|
|
const demosFetcher = nextProps.utils.get(nextProps.data, [...pageDataPath, 'demo']);
|
|
if (demosFetcher) {
|
|
const [localizedPageData, demos] = await Promise.all([pageDataPromise, demosFetcher()]);
|
|
return { localizedPageData, demos };
|
|
}
|
|
return { localizedPageData: await pageDataPromise };
|
|
})(MainContent);
|