import { Component } from '@angular/core';
import { ModalService } from '../../services/modal/modal.service';
import { Router } from '@angular/router';
import { LoginService } from '../../services/login/login.service';

@Component({
  selector: 'app-home-page',
  templateUrl: './home-page.component.html',
})
export class HomePageComponent {
  currentYear = new Date().getFullYear();

  constructor(
    private loginModalService: ModalService,
    private router: Router,
    private loginService: LoginService
  ) {}

  openLogin() {
    const token = localStorage.getItem('token');
    if (!token) {
      this.router.navigate(['/map']);
    } else {
      this.loginModalService.openModal('login-modal');
    }
  }
}
