Code cleanup + lint

pull/687/head
Michael Shamoon 2 years ago
parent aaa1f76176
commit 12ed730897

@ -26,13 +26,10 @@ export default function Component({ service }) {
); );
} }
// const { torrents } = tdarrData.arguments; const queue = parseInt(tdarrData.table1Count, 10) + parseInt(tdarrData.table4Count, 10);
const processed = parseInt(tdarrData.table2Count, 10) + parseInt(tdarrData.table5Count, 10);
const queue = parseInt(tdarrData.table1Count) + parseInt(tdarrData.table4Count); const errored = parseInt(tdarrData.table3Count, 10) + parseInt(tdarrData.table6Count, 10);
const processed = parseInt(tdarrData.table2Count) + parseInt(tdarrData.table5Count); const saved = parseFloat(tdarrData.sizeDiff, 10) * 1000000000;
const errored = parseInt(tdarrData.table3Count) + parseInt(tdarrData.table6Count);
const saved = parseFloat(tdarrData.sizeDiff) * 1000000000;
return ( return (
<Container service={service}> <Container service={service}>

@ -22,32 +22,22 @@ export default async function tdarrProxyHandler(req, res) {
return res.status(400).json({ error: "Invalid proxy service type" }); return res.status(400).json({ error: "Invalid proxy service type" });
} }
const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget })); const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget }));
const method = "POST"; const [status, contentType, data] = await httpProxy(url, {
method: "POST",
const headers = { body: JSON.stringify({
"content-type": "application/json",
};
const body = JSON.stringify({
"data": { "data": {
"collection": "StatisticsJSONDB", "collection": "StatisticsJSONDB",
"mode": "getById", "mode": "getById",
"docID": "statistics" "docID": "statistics"
} },
}); }),
headers: {
let [status, contentType, data, responseHeaders] = await httpProxy(url, { "content-type": "application/json",
method, },
body,
headers,
}); });
if (status !== 200) { if (status !== 200) {
logger.error("Error getting data from Tdarr: %d. Data: %s", status, data); logger.error("Error getting data from Tdarr: %d. Data: %s", status, data);
return res.status(500).send({error: {message:"Error getting data from Tdarr", url, data}}); return res.status(500).send({error: {message:"Error getting data from Tdarr", url, data}});

Loading…
Cancel
Save