mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 20:07:55 +00:00
Fixed logout issue
This commit is contained in:
@@ -293,10 +293,8 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
if (roomId == null) return;
|
||||
|
||||
emitSafe(GetDevicesLoading());
|
||||
int roomIndex = HomeCubit.getInstance()
|
||||
.selectedSpace!
|
||||
.rooms!
|
||||
.indexWhere((element) => element.id == roomId);
|
||||
int roomIndex =
|
||||
HomeCubit.getInstance().selectedSpace!.rooms!.indexWhere((element) => element.id == roomId);
|
||||
try {
|
||||
HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices =
|
||||
await DevicesAPI.getDevicesByRoomId(roomId);
|
||||
@@ -308,8 +306,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
|
||||
//get status for each device
|
||||
//TODO get devices status per page via page controller instead of getting all devices status at once
|
||||
List<DeviceModel> devices =
|
||||
HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices!;
|
||||
List<DeviceModel> devices = HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices!;
|
||||
if (devices.isNotEmpty) {
|
||||
for (var device in devices) {
|
||||
fetchDevicesStatues(device.uuid!, roomIndex);
|
||||
@@ -334,11 +331,8 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
emitSafe(GetDeviceStatusError(e.toString()));
|
||||
return;
|
||||
}
|
||||
HomeCubit.getInstance()
|
||||
.selectedSpace!
|
||||
.rooms![roomIndex]
|
||||
.devices![deviceIndex]
|
||||
.status = statuses;
|
||||
HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices![deviceIndex].status =
|
||||
statuses;
|
||||
emitSafe(GetDeviceStatusSuccess(code: code));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user