mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
replaced endpoint for get automaiton by id
This commit is contained in:
@ -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 = {};
|
||||
|
@ -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),
|
||||
);
|
||||
|
@ -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}';
|
||||
|
||||
|
Reference in New Issue
Block a user