fix: configureNodeWiFi method to properly check the response structure
This commit is contained in:
@@ -296,8 +296,10 @@ class WiFiConfigComponent extends Component {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
// Check if the API call was successful based on the response structure
|
||||||
throw new Error(response.error || 'Failed to configure WiFi');
|
if (!response || response.status !== 200) {
|
||||||
|
const errorMessage = response?.data?.message || response?.error || 'Failed to configure WiFi';
|
||||||
|
throw new Error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
Reference in New Issue
Block a user