changed endpoint for automation update

This commit is contained in:
hannathkadher
2025-03-14 12:16:32 +04:00
parent bc64efa557
commit e0486deecb
3 changed files with 15 additions and 7 deletions

View File

@ -808,7 +808,9 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
unitUuid: spaceBloc.state.selectedSpaces[0], sceneId: state.sceneId ?? '');
} else {
await SceneApi.deleteAutomation(
unitUuid: spaceBloc.state.selectedSpaces[0], automationId: state.automationId ?? '',projectId: projectId);
unitUuid: spaceBloc.state.selectedSpaces[0],
automationId: state.automationId ?? '',
projectId: projectId);
}
add(const LoadScenes());
@ -948,6 +950,8 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
FutureOr<void> _onUpdateAutomation(UpdateAutomation event, Emitter<RoutineState> emit) async {
try {
final projectId = await ProjectManager.getProjectUUID() ?? '';
if (state.routineName == null || state.routineName!.isEmpty) {
emit(state.copyWith(
errorMessage: 'Automation name is required',
@ -1057,8 +1061,8 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
actions: actions,
);
final result =
await SceneApi.updateAutomation(createAutomationModel, state.automationId ?? '');
final result = await SceneApi.updateAutomation(
createAutomationModel, state.automationId ?? '', projectId);
if (result['success']) {
add(ResetRoutineState());