don't mutate widget.fields
This commit is contained in:
parent
30e22a0b83
commit
dec6b1aa09
@ -35,10 +35,10 @@ export default function Component({ service }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!suwayomiData) {
|
if (!suwayomiData) {
|
||||||
widget.fields = makeFields(widget.fields);
|
const fields = makeFields(widget.fields);
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
{widget.fields.map((Field) => {
|
{fields.map((Field) => {
|
||||||
const field = Field.toLowerCase();
|
const field = Field.toLowerCase();
|
||||||
return <Block key={field} label={`suwayomi.${field}`} />;
|
return <Block key={field} label={`suwayomi.${field}`} />;
|
||||||
})}
|
})}
|
||||||
|
|||||||
@ -229,11 +229,11 @@ export default async function suwayomiProxyHandler(req, res) {
|
|||||||
return res.status(400).json({ error: "Invalid proxy service type" });
|
return res.status(400).json({ error: "Invalid proxy service type" });
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.fields = makeFields(widget.fields);
|
const fields = makeFields(widget.fields);
|
||||||
|
|
||||||
const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget }));
|
const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget }));
|
||||||
|
|
||||||
const body = makeBody(widget.fields, widget.category);
|
const body = makeBody(fields, widget.category);
|
||||||
|
|
||||||
const headers = makeHeaders(widget);
|
const headers = makeHeaders(widget);
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ export default async function suwayomiProxyHandler(req, res) {
|
|||||||
/** @type {ResponseJSON|ResponseJSONcategory} */
|
/** @type {ResponseJSON|ResponseJSONcategory} */
|
||||||
const responseJSON = JSON.parse(data);
|
const responseJSON = JSON.parse(data);
|
||||||
|
|
||||||
const returnData = extractCounts(responseJSON, widget.fields);
|
const returnData = extractCounts(responseJSON, fields);
|
||||||
|
|
||||||
if (contentType) res.setHeader("Content-Type", contentType);
|
if (contentType) res.setHeader("Content-Type", contentType);
|
||||||
return res.status(status).send(returnData);
|
return res.status(status).send(returnData);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user