mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
Fix: fritzbox error when response contains empty values (#2463)
This commit is contained in:
parent
bccd73fe2d
commit
d38b313177
1 changed files with 2 additions and 2 deletions
|
@ -33,9 +33,9 @@ async function requestEndpoint(apiBaseUrl, service, action) {
|
|||
const response = {};
|
||||
try {
|
||||
const jsonData = JSON.parse(xml2json(data));
|
||||
const responseElements = jsonData?.elements[0]?.elements[0]?.elements[0]?.elements || [];
|
||||
const responseElements = jsonData?.elements?.[0]?.elements?.[0]?.elements?.[0]?.elements || [];
|
||||
responseElements.forEach((element) => {
|
||||
response[element.name] = element.elements[0]?.text || "";
|
||||
response[element.name] = element.elements?.[0].text || "";
|
||||
});
|
||||
} catch (e) {
|
||||
logger.debug(`Failed parsing ${service}->${action} response:`, data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue