mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 23:44:53 +00:00
add all devices fetch
This commit is contained in:
@ -291,7 +291,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
fetchDevicesByRoomId(String? roomId) async {
|
||||
if (roomId == null) return;
|
||||
if (roomId == '-1') {
|
||||
return fetchAllDevices();
|
||||
return fetchAllDevices(roomId);
|
||||
}
|
||||
|
||||
emitSafe(GetDevicesLoading());
|
||||
@ -320,13 +320,15 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
// }
|
||||
}
|
||||
|
||||
void fetchAllDevices() async {
|
||||
void fetchAllDevices(String roomId) async {
|
||||
emitSafe(GetDevicesLoading());
|
||||
try {
|
||||
final allDevices = await HomeManagementAPI.fetchDevicesByUserId();
|
||||
|
||||
emitSafe(GetDevicesSuccess(allDevices));
|
||||
} catch (e) {
|
||||
emitSafe(GetDevicesError(e.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user