Commit 86a2d26d authored by afc163's avatar afc163

simplify code

parent b27bf8de
......@@ -9,13 +9,10 @@ const dynamicWrapper = (app, models, component) => dynamic({
models: () => models.filter(m => !app._models.some(({ namespace }) => namespace === m)).map(m => import(`../models/${m}.js`)),
// add routerData prop
component: () => {
const p = component();
const routerData = getRouterData(app);
return new Promise((resolve, reject) => {
p.then((raw) => {
const Comp = raw.default || raw;
resolve(props => <Comp {...props} routerData={routerData} />);
}).catch(err => reject(err));
return component().then((raw) => {
const Component = raw.default || raw;
return props => <Component {...props} routerData={routerData} />;
});
},
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment