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) {
|
||||
return Center(child: Text(state.error!));
|
||||
return const Center(child: Text('Something went wrong'));
|
||||
} else {
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
@@ -13,22 +13,26 @@ class HomeManagementAPI {
|
||||
var userId = await storage.read(key: UserModel.userUuidKey) ?? '';
|
||||
|
||||
List<DeviceModel> list = [];
|
||||
await _httpService.get(
|
||||
path: ApiEndpoints.getDevicesByUserId.replaceAll("{userId}", userId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
json.forEach((value) {
|
||||
list.add(DeviceModel.fromJson(value));
|
||||
try {
|
||||
await _httpService.get(
|
||||
path: ApiEndpoints.getDevicesByUserId.replaceAll("{userId}", userId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
json.forEach((value) {
|
||||
list.add(DeviceModel.fromJson(value));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static Future<List<DeviceModel>> fetchDevicesByUnitId() async {
|
||||
List<DeviceModel> list = [];
|
||||
await _httpService.get(
|
||||
path: ApiEndpoints.getDevicesByUnitId
|
||||
.replaceAll("{unitUuid}", HomeCubit.getInstance().selectedSpace?.id ?? ''),
|
||||
path: ApiEndpoints.getDevicesByUnitId.replaceAll(
|
||||
"{unitUuid}", HomeCubit.getInstance().selectedSpace?.id ?? ''),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
json.forEach((value) {
|
||||
@@ -38,7 +42,8 @@ class HomeManagementAPI {
|
||||
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 {
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.assignDeviceToRoom,
|
||||
|
||||
Reference in New Issue
Block a user