mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-14 09:17:23 +00:00
Refactor device_info_model.dart and devices_api.dart
This commit is contained in:
@ -102,7 +102,8 @@ class DevicesAPI {
|
||||
static Future<Map<String, dynamic>> getPowerClampStatus(
|
||||
String deviceId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{deviceUuid}', deviceId),
|
||||
path: ApiEndpoints.deviceFunctionsStatus
|
||||
.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
@ -144,7 +145,7 @@ class DevicesAPI {
|
||||
path: ApiEndpoints.deviceScene.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
return json['data'];
|
||||
});
|
||||
return response;
|
||||
}
|
||||
@ -592,11 +593,12 @@ class DevicesAPI {
|
||||
return <DeviceModel>[];
|
||||
}
|
||||
final result = <DeviceModel>[];
|
||||
for (final device in data) {
|
||||
final mappedDevice = DeviceModel.fromJson(device);
|
||||
if (mappedDevice.productType?.name != DeviceType.FlushMountedSensor.name) {
|
||||
result.add(mappedDevice);
|
||||
}
|
||||
for (final device in data) {
|
||||
final mappedDevice = DeviceModel.fromJson(device);
|
||||
if (mappedDevice.productType?.name !=
|
||||
DeviceType.FlushMountedSensor.name) {
|
||||
result.add(mappedDevice);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
Reference in New Issue
Block a user