Update src/components/appRouter.js

Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>
This commit is contained in:
vitorsemeano 2020-11-11 11:58:59 +00:00 committed by GitHub
parent 2015665a64
commit 138e8460f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -314,17 +314,18 @@ class AppRouter {
url += '?' + ctx.querystring;
}
let promise;
if (route.serverRequest) {
const apiClient = ServerConnections.currentApiClient();
url = apiClient.getUrl(`/web${url}`);
apiClient.get(url).then(html => this.loadContent(ctx, route, html, request));
promise = apiClient.get(url);
} else {
import(/* webpackChunkName: "[request]" */ `../controllers/${url}`).then((html) => {
this.loadContent(ctx, route, html, request);
});
promise = import(/* webpackChunkName: "[request]" */ `../controllers/${url}`);
}
promise.then((html) => {
this.loadContent(ctx, route, html, request);
});
}
handleRoute(ctx, next, route) {