mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-10-30 05:54:05 +00:00 
			
		
		
		
	Fix: fritzbox error when response contains empty values (#2463)
This commit is contained in:
		
							parent
							
								
									bccd73fe2d
								
							
						
					
					
						commit
						d38b313177
					
				| @ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Thorben
						Thorben