import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.scss"],
})
export class AppComponent implements OnInit {
  title = "black-dashboard-angular";
  companyLocalStorage: any;

  constructor(private router: Router) {
    this.companyLocalStorage = JSON.parse(
      localStorage.getItem("companyData") || "{}"
    );
  }

  ngOnInit(): void {
    if (this.companyLocalStorage) {
      this.router.navigate(["/company-information"]);
    } else {
      this.router.navigate(["/login"]);
    }
  }
}
