feature/gateway #21
@@ -285,7 +285,7 @@ class WiFiConfigComponent extends Component {
|
|||||||
|
|
||||||
async configureNodeWiFi(node, ssid, password) {
|
async configureNodeWiFi(node, ssid, password) {
|
||||||
logger.debug('WiFiConfigComponent: Configuring WiFi for node:', node.ip);
|
logger.debug('WiFiConfigComponent: Configuring WiFi for node:', node.ip);
|
||||||
|
|
||||||
const response = await window.apiClient.callEndpoint({
|
const response = await window.apiClient.callEndpoint({
|
||||||
ip: node.ip,
|
ip: node.ip,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -295,11 +295,13 @@ class WiFiConfigComponent extends Component {
|
|||||||
{ name: 'password', value: password, location: 'body' }
|
{ name: 'password', value: password, location: 'body' }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
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