mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-28 17:49:40 +00:00
changed endpoint for getting automations by space
This commit is contained in:
@ -46,8 +46,11 @@ class SceneBloc extends Bloc<SceneEvent, SceneState> {
|
||||
emit(SceneLoading());
|
||||
|
||||
try {
|
||||
Project? project = HomeCubit.getInstance().project;
|
||||
|
||||
if (event.unitId.isNotEmpty) {
|
||||
automationList = await SceneApi.getAutomationByUnitId(event.unitId);
|
||||
automationList = await SceneApi.getAutomationByUnitId(
|
||||
event.unitId, event.communityId, project?.uuid ?? '');
|
||||
emit(SceneLoaded(scenes, automationList));
|
||||
} else {
|
||||
emit(const SceneError(message: 'Unit ID is empty'));
|
||||
@ -96,11 +99,16 @@ class SceneBloc extends Bloc<SceneEvent, SceneState> {
|
||||
));
|
||||
|
||||
try {
|
||||
Project? project = HomeCubit.getInstance().project;
|
||||
|
||||
final success = await SceneApi.updateAutomationStatus(
|
||||
event.automationId, event.automationStatusUpdate);
|
||||
if (success) {
|
||||
automationList = await SceneApi.getAutomationByUnitId(
|
||||
event.automationStatusUpdate.spaceUuid);
|
||||
event.automationStatusUpdate.spaceUuid,
|
||||
event.communityId,
|
||||
project?.uuid ?? ''
|
||||
);
|
||||
newLoadingStates[event.automationId] = false;
|
||||
emit(SceneLoaded(
|
||||
currentState.scenes,
|
||||
|
@ -22,11 +22,13 @@ class LoadScenes extends SceneEvent {
|
||||
|
||||
class LoadAutomation extends SceneEvent {
|
||||
final String unitId;
|
||||
final String communityId;
|
||||
|
||||
const LoadAutomation(this.unitId);
|
||||
|
||||
const LoadAutomation(this.unitId, this.communityId);
|
||||
|
||||
@override
|
||||
List<Object> get props => [unitId];
|
||||
List<Object> get props => [unitId, communityId];
|
||||
}
|
||||
|
||||
class SceneTrigger extends SceneEvent {
|
||||
@ -43,8 +45,9 @@ class SceneTrigger extends SceneEvent {
|
||||
class UpdateAutomationStatus extends SceneEvent {
|
||||
final String automationId;
|
||||
final AutomationStatusUpdate automationStatusUpdate;
|
||||
final String communityId;
|
||||
|
||||
const UpdateAutomationStatus({required this.automationStatusUpdate, required this.automationId});
|
||||
const UpdateAutomationStatus({required this.automationStatusUpdate, required this.automationId, required this.communityId});
|
||||
|
||||
@override
|
||||
List<Object> get props => [automationStatusUpdate];
|
||||
|
Reference in New Issue
Block a user