diff --git a/src/widgets/wgeasy/component.jsx b/src/widgets/wgeasy/component.jsx index 1b3e0196..624002c4 100644 --- a/src/widgets/wgeasy/component.jsx +++ b/src/widgets/wgeasy/component.jsx @@ -15,7 +15,7 @@ export default function Component({ service }) { return ; } - if (!infoData || infoData.errorCode) { + if (!infoData) { return ( diff --git a/src/widgets/wgeasy/proxy.js b/src/widgets/wgeasy/proxy.js index d4289dc6..53c646e2 100644 --- a/src/widgets/wgeasy/proxy.js +++ b/src/widgets/wgeasy/proxy.js @@ -69,7 +69,15 @@ export default async function wgeasyProxyHandler(req, res) { }, ); - return res.json(JSON.parse(data)); + const parsedData = JSON.parse(data); + + if (parsedData.statusCode > 400) { + return res + .status(parsedData.statusCode) + .json({ error: { message: "Error communicating with Wg-Easy", data: parsedData } }); + } + + return res.json(parsedData); } }