fix: firmware upload failure
This commit is contained in:
@@ -94,13 +94,19 @@ class ApiClient {
|
||||
async uploadFirmware(file, nodeIp) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return this.request(`/api/node/update`, {
|
||||
const data = await this.request(`/api/node/update`, {
|
||||
method: 'POST',
|
||||
query: { ip: nodeIp },
|
||||
body: formData,
|
||||
isForm: true,
|
||||
headers: {},
|
||||
});
|
||||
// Some endpoints may return HTTP 200 with success=false on logical failure
|
||||
if (data && data.success === false) {
|
||||
const message = data.message || 'Firmware upload failed';
|
||||
throw new Error(message);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user