Skip to content
Snippets Groups Projects
Commit 42cf463e authored by Marlène SIMONDANT's avatar Marlène SIMONDANT
Browse files

fix(carto) : url params should be kept after coming back from a structure's details

parent c0a16580
Branches
Tags
2 merge requests!945V3.3.0,!941fix(carto) : url params should be kept after coming back from a structure's details
......@@ -25,6 +25,8 @@ export class StructureListComponent implements OnChanges, OnInit {
public structure: Structure;
public printMode = false;
public savedQuery = {};
private queryParamsCaptured = false;
constructor(
private route: ActivatedRoute,
......@@ -92,12 +94,26 @@ export class StructureListComponent implements OnChanges, OnInit {
}
public showDetails(structure: Structure): void {
if (!this.queryParamsCaptured) {
if (Object.keys(this.route.snapshot.queryParams).length > 0) {
this.savedQuery = { ...this.route.snapshot.queryParams };
}
this.queryParamsCaptured = true;
}
this.structure = structure;
this.selectedMarkerId.emit(this.structure._id);
}
public closeDetails(): void {
if (this.savedQuery) {
this.router.navigate([], {
relativeTo: this.route,
queryParams: this.savedQuery,
queryParamsHandling: 'merge',
});
}
this.selectedMarkerId.emit();
this.queryParamsCaptured = false;
}
public handleCardHover(structure: Structure): void {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment