diff --git a/src/widgets/xteve/component.jsx b/src/widgets/xteve/component.jsx index 2568301a..9d22e8a1 100644 --- a/src/widgets/xteve/component.jsx +++ b/src/widgets/xteve/component.jsx @@ -9,7 +9,7 @@ export default function Component({ service }) { const { widget } = service; - const { data: xteveData, error: xteveError } = useWidgetAPI(widget, "xteve"); + const { data: xteveData, error: xteveError } = useWidgetAPI(widget, "api"); if (xteveError) { return ; @@ -27,9 +27,9 @@ export default function Component({ service }) { return ( - - - + + + ); } diff --git a/src/widgets/xteve/proxy.js b/src/widgets/xteve/proxy.js index dada6734..22795b76 100644 --- a/src/widgets/xteve/proxy.js +++ b/src/widgets/xteve/proxy.js @@ -21,18 +21,16 @@ export default async function xteveProxyHandler(req, res) { const url = formatApiCall(api, { endpoint, ...widget }); const method = "POST"; - const payload = { "cmd": "status" }; + const payload = { cmd: "status" }; if (widget.username && widget.password) { - const body = JSON.stringify({ - "cmd": "login", - "username": widget.username, - "password": widget.password, - }); - const [status, contentType, data] = await httpProxy(url, { method, - body, + body: JSON.stringify({ + cmd: "login", + username: widget.username, + password: widget.password, + }) }); if (status !== 200) { @@ -49,11 +47,9 @@ export default async function xteveProxyHandler(req, res) { payload.token = json.token; } - const body = JSON.stringify(payload); - const [status, contentType, data] = await httpProxy(url, { method, - body, + body: JSON.stringify(payload) }); if (status !== 200) { diff --git a/src/widgets/xteve/widget.js b/src/widgets/xteve/widget.js index 7e65b8b6..59b6e3fa 100644 --- a/src/widgets/xteve/widget.js +++ b/src/widgets/xteve/widget.js @@ -5,7 +5,7 @@ const widget = { proxyHandler: xteveProxyHandler, mappings: { - "xteve": { + "api": { endpoint: "api/", }, },