ESLint: Auto reformat and fixing some warnings / errors.

This commit is contained in:
baldo 2022-08-23 20:08:53 +02:00
parent 5237db38e0
commit 91690509d3
50 changed files with 2141 additions and 1493 deletions
server/resources

View file

@ -1,26 +1,36 @@
import {promises as fs} from "graceful-fs";
import { promises as fs } from "graceful-fs";
import ErrorTypes from "../utils/errorTypes";
import Logger from "../logger";
import * as Resources from "../utils/resources";
import {Request, Response} from "express";
import { Request, Response } from "express";
const indexHtml = __dirname + '/../../client/index.html';
const indexHtml = __dirname + "/../../client/index.html";
export function render (req: Request, res: Response): void {
export function render(req: Request, res: Response): void {
const data = Resources.getData(req);
fs.readFile(indexHtml, 'utf8')
.then(body =>
fs.readFile(indexHtml, "utf8")
.then((body) =>
Resources.successHtml(
res,
body.replace(
/<body/,
'<script>window.__nodeToken = \''+ data.token + '\';</script><body'
"<script>window.__nodeToken = '" +
data.token +
"';</script><body"
)
))
.catch(err => {
Logger.tag('frontend').error('Could not read file: ', indexHtml, err);
return Resources.error(res, {data: 'Internal error.', type: ErrorTypes.internalError});
})
)
)
.catch((err) => {
Logger.tag("frontend").error(
"Could not read file: ",
indexHtml,
err
);
return Resources.error(res, {
data: "Internal error.",
type: ErrorTypes.internalError,
});
});
}