mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 09:17:56 +00:00
push low connection
This commit is contained in:
@@ -118,7 +118,7 @@ class SceneDevicesBody extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else if (state.error != null) {
|
} else if (state.error != null) {
|
||||||
return Center(child: Text(state.error!));
|
return const Center(child: Text('Something went wrong'));
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,22 +13,26 @@ class HomeManagementAPI {
|
|||||||
var userId = await storage.read(key: UserModel.userUuidKey) ?? '';
|
var userId = await storage.read(key: UserModel.userUuidKey) ?? '';
|
||||||
|
|
||||||
List<DeviceModel> list = [];
|
List<DeviceModel> list = [];
|
||||||
await _httpService.get(
|
try {
|
||||||
path: ApiEndpoints.getDevicesByUserId.replaceAll("{userId}", userId),
|
await _httpService.get(
|
||||||
showServerMessage: false,
|
path: ApiEndpoints.getDevicesByUserId.replaceAll("{userId}", userId),
|
||||||
expectedResponseModel: (json) {
|
showServerMessage: false,
|
||||||
json.forEach((value) {
|
expectedResponseModel: (json) {
|
||||||
list.add(DeviceModel.fromJson(value));
|
json.forEach((value) {
|
||||||
|
list.add(DeviceModel.fromJson(value));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<DeviceModel>> fetchDevicesByUnitId() async {
|
static Future<List<DeviceModel>> fetchDevicesByUnitId() async {
|
||||||
List<DeviceModel> list = [];
|
List<DeviceModel> list = [];
|
||||||
await _httpService.get(
|
await _httpService.get(
|
||||||
path: ApiEndpoints.getDevicesByUnitId
|
path: ApiEndpoints.getDevicesByUnitId.replaceAll(
|
||||||
.replaceAll("{unitUuid}", HomeCubit.getInstance().selectedSpace?.id ?? ''),
|
"{unitUuid}", HomeCubit.getInstance().selectedSpace?.id ?? ''),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
json.forEach((value) {
|
json.forEach((value) {
|
||||||
@@ -38,7 +42,8 @@ class HomeManagementAPI {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> assignDeviceToRoom(Map<String, String> body) async {
|
static Future<Map<String, dynamic>> assignDeviceToRoom(
|
||||||
|
Map<String, String> body) async {
|
||||||
try {
|
try {
|
||||||
final response = await _httpService.put(
|
final response = await _httpService.put(
|
||||||
path: ApiEndpoints.assignDeviceToRoom,
|
path: ApiEndpoints.assignDeviceToRoom,
|
||||||
|
|||||||
Reference in New Issue
Block a user