diff --git a/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts b/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts index 8985d326..3e361ce9 100644 --- a/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts +++ b/src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts @@ -226,6 +226,7 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.datatargetid = response.id; this.datatarget = response; this.showSavedSnack(); + this.routeToCreatedDatatarget(); }, (error: HttpErrorResponse) => { this.handleError(error); @@ -271,10 +272,15 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.scrollToTopService.scrollToTop(); } - routeToDatatargets(): void { - this.router.navigate(["applications", this.applicationId.toString()]); + routeToDatatargets() { + this.router.navigate(["applications", this.applicationId, "data-targets"]); } + routeToCreatedDatatarget() { + this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], { + replaceUrl: true, + }); + } onCoordinateKey(event: any) { if (event.target.value.length > event.target.maxLength) { event.target.value = event.target.value.slice(0, event.target.maxLength); diff --git a/src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts b/src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts index df0d12c3..7287283c 100644 --- a/src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts +++ b/src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts @@ -282,11 +282,15 @@ export class HttppushEditComponent implements DatatargetEdit, OnInit, OnDestroy this.scrollToTopService.scrollToTop(); } - routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]); - routeToCreatedDatatarget = () => + routeToDatatargets() { + this.router.navigate(["applications", this.applicationId, "data-targets"]); + } + + routeToCreatedDatatarget() { this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], { replaceUrl: true, }); + } onCoordinateKey(event: any) { if (event.target.value.length > event.target.maxLength) { diff --git a/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts b/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts index 7b85d9c8..189b6f71 100644 --- a/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts +++ b/src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts @@ -90,9 +90,14 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.errorMessages = errors.errorMessages; this.scrollToTopService.scrollToTop(); } + routeToDatatargets() { + this.router.navigate(["applications", this.applicationId, "data-targets"]); + } - routeToDatatargets(): void { - this.router.navigate(["applications", this.applicationId.toString()]); + routeToCreatedDatatarget() { + this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], { + replaceUrl: true, + }); } getDatatarget(id: number) { @@ -214,7 +219,7 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy { this.datatargetId = response.id; this.datatarget = response; this.snackService.showSavedSnack(); - this.routeToDatatargets(); + this.routeToCreatedDatatarget(); }, (error: HttpErrorResponse) => { this.handleError(error);