replaced endpoint for get automaiton by id

This commit is contained in:
hannathkadher
2025-03-14 12:09:14 +04:00
parent 7ae3e4a933
commit 2a065efc0e
3 changed files with 10 additions and 4 deletions

View File

@ -1079,6 +1079,8 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
Future<void> _onGetAutomationDetails(
GetAutomationDetails event, Emitter<RoutineState> emit) async {
try {
final projectUuid = await ProjectManager.getProjectUUID() ?? '';
emit(state.copyWith(
isLoading: true,
isUpdate: true,
@ -1089,7 +1091,8 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
thenItems: [],
));
final automationDetails = await SceneApi.getAutomationDetails(event.automationId);
final automationDetails =
await SceneApi.getAutomationDetails(event.automationId, projectUuid);
final Map<String, Map<String, dynamic>> deviceIfCards = {};
final Map<String, Map<String, dynamic>> deviceThenCards = {};

View File

@ -133,10 +133,13 @@ class SceneApi {
// }
//automation details
static Future<RoutineDetailsModel> getAutomationDetails(String automationId) async {
static Future<RoutineDetailsModel> getAutomationDetails(
String automationId, String projectId) async {
try {
final response = await _httpService.get(
path: ApiEndpoints.getAutomationDetails.replaceAll('{automationId}', automationId),
path: ApiEndpoints.getAutomationDetails
.replaceAll('{automationId}', automationId)
.replaceAll('{projectId}', projectId),
showServerMessage: false,
expectedResponseModel: (json) => RoutineDetailsModel.fromMap(json),
);

View File

@ -75,7 +75,7 @@ abstract class ApiEndpoints {
static const String createAutomation = '/projects/{projectId}/automations';
static const String getUnitScenes =
'/projects/{projectId}/communities/{communityUuid}/spaces/{spaceUuid}/scenes';
static const String getAutomationDetails = '/automation/details/{automationId}';
static const String getAutomationDetails = '/projects/{projectId}/automations/{automationId}';
static const String getScene = '/scene/tap-to-run/{sceneId}';
static const String deleteScene = '/scene/tap-to-run/{sceneId}';