Skip to content
Snippets Groups Projects
Commit 0aca5b21 authored by Antonin COQUET's avatar Antonin COQUET
Browse files

fix auto reload of structure

parent e2244d3d
No related branches found
No related tags found
3 merge requests!178release V1.10.0,!135Dev,!122Feat/structure query param
......@@ -8,6 +8,7 @@ import { Filter } from '../structure-list/models/filter.model';
import { GeoJson } from '../map/models/geojson.model';
import { GeojsonService } from '../services/geojson.service';
import { CustomRegExp } from '../utils/CustomRegExp';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-carto',
......@@ -26,14 +27,21 @@ export class CartoComponent implements OnInit {
public isMapPhone = false;
public searchedValue = null;
public locate = false; // Use to sync location between search and map
constructor(private structureService: StructureService, private geoJsonService: GeojsonService) {}
constructor(
private structureService: StructureService,
private geoJsonService: GeojsonService,
private activatedRoute: ActivatedRoute
) {}
ngOnInit(): void {
if (navigator.geolocation) {
this.getLocation();
} else {
this.getStructures(null);
if (!this.activatedRoute.snapshot.queryParamMap.get('search')) {
if (navigator.geolocation) {
this.getLocation();
} else {
this.getStructures(null);
}
}
if (history.state.data) {
this.currentStructure = new Structure(history.state.data);
}
......
......@@ -61,7 +61,6 @@ export class SearchComponent implements OnInit, OnChanges {
this.categories = [];
this.checkedModulesFilter = new Array();
if (this.queryString) {
console.log('we search', this.queryString);
const filters: Filter[] = [];
filters.push(new Filter('query', this.queryString));
this.searchEvent.emit(filters);
......@@ -97,7 +96,6 @@ export class SearchComponent implements OnInit, OnChanges {
this.location.go('/acteurs');
}
this.queryString = this.activatedRoute.snapshot.queryParamMap.get('search');
console.log('query string is:', this.queryString);
const filters: Filter[] = [];
if (term) {
filters.push(new Filter('query', term));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment