eslint fixes

This commit is contained in:
Marcus Kimpenhaus 2022-12-26 02:30:14 +01:00
parent 3a687d8b5d
commit 19e09ace35

View File

@ -21,7 +21,7 @@ export default async function xteveProxyHandler(req, res) {
const url = formatApiCall(api, { endpoint, ...widget }); const url = formatApiCall(api, { endpoint, ...widget });
const method = "POST"; const method = "POST";
let payload = { "cmd": "status" }; const payload = { "cmd": "status" };
if (widget.username && widget.password) { if (widget.username && widget.password) {
const body = JSON.stringify({ const body = JSON.stringify({
@ -30,7 +30,7 @@ export default async function xteveProxyHandler(req, res) {
"password": widget.password, "password": widget.password,
}); });
let [status, contentType, data] = await httpProxy(url, { const [status, contentType, data] = await httpProxy(url, {
method, method,
body, body,
}); });
@ -42,16 +42,16 @@ export default async function xteveProxyHandler(req, res) {
const json = JSON.parse(data.toString()); const json = JSON.parse(data.toString());
if (json?.status !== true) { if (json?.status !== true) {
let message = "Authentication failed."; const message = "Authentication failed.";
return res.status(401).end(JSON.stringify({error: { message: message } })); return res.status(401).end(JSON.stringify({error: { message } }));
} }
payload["token"] = json.token; payload.token = json.token;
} }
const body = JSON.stringify(payload); const body = JSON.stringify(payload);
let [status, contentType, data] = await httpProxy(url, { const [status, contentType, data] = await httpProxy(url, {
method, method,
body, body,
}); });