import { Component } from '@angular/core';
import {Router} from '@angular/router';
import {mapReducers} from '@farmmaps/common-map';
import {StateSerializerService} from '@farmmaps/common';
import { tassign } from 'tassign';

@Component({
  selector: 'app-menu',
  templateUrl: './menu.component.html',
  styleUrls: ['./menu.component.scss']
})
export class MenuComponent {
  

  constructor( private stateSerializerService:StateSerializerService,private router:Router ) { }

  handlePredefinedQuery(event: MouseEvent, query: any) {
    event.preventDefault();
    const queryState = this.stateSerializerService.serialize(tassign(mapReducers.initialQueryState, query));
    this.router.navigate(['map',queryState])
  }
}
