mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
updated delete automation endpoint
This commit is contained in:
@ -798,6 +798,8 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
|
|
||||||
FutureOr<void> _deleteScene(DeleteScene event, Emitter<RoutineState> emit) async {
|
FutureOr<void> _deleteScene(DeleteScene event, Emitter<RoutineState> emit) async {
|
||||||
try {
|
try {
|
||||||
|
final projectId = await ProjectManager.getProjectUUID() ?? '';
|
||||||
|
|
||||||
emit(state.copyWith(isLoading: true));
|
emit(state.copyWith(isLoading: true));
|
||||||
BuildContext context = NavigationService.navigatorKey.currentContext!;
|
BuildContext context = NavigationService.navigatorKey.currentContext!;
|
||||||
var spaceBloc = context.read<SpaceTreeBloc>();
|
var spaceBloc = context.read<SpaceTreeBloc>();
|
||||||
@ -806,7 +808,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
unitUuid: spaceBloc.state.selectedSpaces[0], sceneId: state.sceneId ?? '');
|
unitUuid: spaceBloc.state.selectedSpaces[0], sceneId: state.sceneId ?? '');
|
||||||
} else {
|
} else {
|
||||||
await SceneApi.deleteAutomation(
|
await SceneApi.deleteAutomation(
|
||||||
unitUuid: spaceBloc.state.selectedSpaces[0], automationId: state.automationId ?? '');
|
unitUuid: spaceBloc.state.selectedSpaces[0], automationId: state.automationId ?? '',projectId: projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
add(const LoadScenes());
|
add(const LoadScenes());
|
||||||
|
@ -213,12 +213,12 @@ class SceneApi {
|
|||||||
|
|
||||||
// delete automation
|
// delete automation
|
||||||
static Future<bool> deleteAutomation(
|
static Future<bool> deleteAutomation(
|
||||||
{required String unitUuid, required String automationId}) async {
|
{required String unitUuid, required String automationId, required String projectId}) async {
|
||||||
try {
|
try {
|
||||||
final response = await _httpService.delete(
|
final response = await _httpService.delete(
|
||||||
path: ApiEndpoints.deleteAutomation
|
path: ApiEndpoints.deleteAutomation
|
||||||
.replaceAll('{automationId}', automationId)
|
.replaceAll('{automationId}', automationId)
|
||||||
.replaceAll('{unitUuid}', unitUuid),
|
.replaceAll('{projectId}', projectId),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) => json['statusCode'] == 200,
|
expectedResponseModel: (json) => json['statusCode'] == 200,
|
||||||
);
|
);
|
||||||
|
@ -79,7 +79,7 @@ abstract class ApiEndpoints {
|
|||||||
static const String getScene = '/scene/tap-to-run/{sceneId}';
|
static const String getScene = '/scene/tap-to-run/{sceneId}';
|
||||||
static const String deleteScene = '/scene/tap-to-run/{sceneId}';
|
static const String deleteScene = '/scene/tap-to-run/{sceneId}';
|
||||||
|
|
||||||
static const String deleteAutomation = '/automation/{automationId}';
|
static const String deleteAutomation = '/projects/{projectId}/automations/{automationId}';
|
||||||
static const String updateScene = '/scene/tap-to-run/{sceneId}';
|
static const String updateScene = '/scene/tap-to-run/{sceneId}';
|
||||||
|
|
||||||
static const String updateAutomation = '/automation/{automationId}';
|
static const String updateAutomation = '/automation/{automationId}';
|
||||||
|
Reference in New Issue
Block a user