fixing circular dependencies, part 1

This commit is contained in:
Roman committed 2020-06-22 14:56:54 +03:00
1 parent 5d6826771a
commit 29197dcfb9
11 files changed
+37 -19

No files matched your search

+3 -3
View File
@@ -9,7 +9,7 @@ import { kubeconfigRoute } from "./routes/kubeconfig"
import { metricsRoute } from "./routes/metrics"
import { watchRoute } from "./routes/watch"
import { portForwardRoute } from "./routes/port-forward"
import { getOutPath } from "../common/register-static";
import { outDir, reactAppName } from "../common/vars";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Call = require('@hapi/call');
@@ -86,11 +86,11 @@ export class Router {
}
protected handleStaticFile(filePath: string, response: http.ServerResponse) {
const asset = getOutPath(filePath);
const asset = path.resolve(outDir, filePath);
readFile(asset, (err, data) => {
if (err) {
// default to index.html so that react routes work when page is refreshed
this.handleStaticFile("app_react.html", response)
this.handleStaticFile(`${reactAppName}.html`, response)
} else {
const type = mimeTypes[path.extname(asset).slice(1)] || "text/plain";
response.setHeader("Content-Type", type);