mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 18:16:21 +00:00
updated endpoint for getting automation by id
This commit is contained in:
@ -427,6 +427,8 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
||||
emit(CreateSceneLoading());
|
||||
|
||||
try {
|
||||
Project? project = HomeCubit.getInstance().project;
|
||||
|
||||
tasksList.clear();
|
||||
tempTasksList.clear();
|
||||
selectedValues.clear();
|
||||
@ -442,7 +444,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
||||
conditionRule = 'or';
|
||||
|
||||
final response = event.isAutomation
|
||||
? await SceneApi.getAutomationDetails(event.sceneId)
|
||||
? await SceneApi.getAutomationDetails(event.sceneId, project?.uuid ?? '')
|
||||
: await SceneApi.getSceneDetails(event.sceneId);
|
||||
if (response.id.isNotEmpty) {
|
||||
if (event.isAutomation) {
|
||||
|
@ -156,7 +156,7 @@ abstract class ApiEndpoints {
|
||||
static const String getUnitAutomation = '/projects/{projectId}/communities/{communityId}/spaces/{unitUuid}/automations';
|
||||
|
||||
static const String getAutomationDetails =
|
||||
'/automation/details/{automationId}';
|
||||
'/projects/{projectId}/automations/{automationId}';
|
||||
|
||||
/// PUT
|
||||
static const String updateScene = '/scene/tap-to-run/{sceneId}';
|
||||
|
@ -119,11 +119,12 @@ class SceneApi {
|
||||
|
||||
//automation details
|
||||
static Future<SceneDetailsModel> getAutomationDetails(
|
||||
String automationId) async {
|
||||
String automationId, String projectId) async {
|
||||
try {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.getAutomationDetails
|
||||
.replaceAll('{automationId}', automationId),
|
||||
.replaceAll('{automationId}', automationId)
|
||||
.replaceAll('{projectId}', projectId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) => SceneDetailsModel.fromJson(json),
|
||||
);
|
||||
|
Reference in New Issue
Block a user