Skip to content

Commit 6bc7c07

Browse files
authored
Merge pull request #142 from Gid733/master
Added reverse routing handling
2 parents 68654ff + 3d3aa72 commit 6bc7c07

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

eform-client/src/app/modules/cases/components/case-edit/case-edit.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class CaseEditComponent implements OnInit, OnDestroy {
3030
isSaveClicked = false;
3131

3232
spinnerStatus = false;
33+
reverseRoute: string;
3334

3435
constructor(private activateRoute: ActivatedRoute,
3536
private casesService: CasesService,
@@ -39,6 +40,9 @@ export class CaseEditComponent implements OnInit, OnDestroy {
3940
this.id = +params['id'];
4041
this.templateId = +params['templateId'];
4142
});
43+
this.activateRoute.queryParams.subscribe(params => {
44+
this.reverseRoute = params['reverseRoute'];
45+
});
4246
}
4347

4448
ngOnInit() {
@@ -77,7 +81,11 @@ export class CaseEditComponent implements OnInit, OnDestroy {
7781
this.spinnerStatus = false;
7882
this.isNoSaveExitAllowed = true;
7983
if (this.isSaveClicked) {
80-
this.router.navigate(['/cases/', this.currentTemplate.id]).then();
84+
if (!this.reverseRoute) {
85+
this.router.navigate(['/cases/', this.currentTemplate.id]).then();
86+
} else {
87+
this.router.navigate([this.reverseRoute]);
88+
}
8189
}
8290
}
8391
this.spinnerStatus = false;
@@ -107,6 +115,7 @@ export class CaseEditComponent implements OnInit, OnDestroy {
107115
this.saveCase();
108116
} else {
109117
this.isNoSaveExitAllowed = true;
118+
this.router.navigate([this.reverseRoute]).then();
110119
}
111120
}
112121

0 commit comments

Comments
 (0)