mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Update RealtimeDeviceChangesBloc to handle loading and failure states
This commit is contained in:
@ -26,6 +26,7 @@ class RealtimeDeviceChangesBloc
|
||||
final currentState = state;
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: RealtimeDeviceChangesStatus.loaded,
|
||||
deviceStatusList: [
|
||||
...currentState.deviceStatusList.where((device) =>
|
||||
!data.any((newDevice) => newDevice.code == device.code)),
|
||||
@ -36,7 +37,7 @@ class RealtimeDeviceChangesBloc
|
||||
},
|
||||
onError: (error, _) => emit(
|
||||
state.copyWith(
|
||||
status: RealtimeDeviceChangesStatus.error,
|
||||
status: RealtimeDeviceChangesStatus.failure,
|
||||
errorMessage: '$error',
|
||||
),
|
||||
),
|
||||
|
@ -1,6 +1,6 @@
|
||||
part of 'realtime_device_changes_bloc.dart';
|
||||
|
||||
enum RealtimeDeviceChangesStatus { initial, loading, loaded, error }
|
||||
enum RealtimeDeviceChangesStatus { initial, loaded, failure }
|
||||
|
||||
final class RealtimeDeviceChangesState extends Equatable {
|
||||
const RealtimeDeviceChangesState({
|
||||
|
Reference in New Issue
Block a user