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