Commit 86a2d26d authored by afc163's avatar afc163

simplify code

parent b27bf8de
...@@ -9,13 +9,10 @@ const dynamicWrapper = (app, models, component) => dynamic({ ...@@ -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`)), models: () => models.filter(m => !app._models.some(({ namespace }) => namespace === m)).map(m => import(`../models/${m}.js`)),
// add routerData prop // add routerData prop
component: () => { component: () => {
const p = component();
const routerData = getRouterData(app); const routerData = getRouterData(app);
return new Promise((resolve, reject) => { return component().then((raw) => {
p.then((raw) => { const Component = raw.default || raw;
const Comp = raw.default || raw; return props => <Component {...props} routerData={routerData} />;
resolve(props => <Comp {...props} routerData={routerData} />);
}).catch(err => reject(err));
}); });
}, },
}); });
......
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