app.component.ts 1.92 KB
import { Component, OnInit } from '@angular/core';
import { UserService } from './components/UserEntity/user.service';
import { ManageDiscountCodeService } from './components/ManageDiscountCode/managediscountcode.service';
import { SubscriptionPriceService } from './components/SubscriptionPrice/subscriptionprice.service';
import { LicenseService } from './components/LicenseEntity/license.service';
import { ReportService } from './components/Reports/report.service';
//import { MyAuthService } from './shared/my-auth.service';
import { GlobalService } from './Shared/global';
import { Router, NavigationEnd } from '@angular/router';
//import { HttpClient } from '@angular/common/http';
//import { HttpErrorResponse } from '@angular/common/http';
//import { Observable } from 'rxjs/Observable';
@Component({
  selector: 'app-component',
  templateUrl: '../app/app.component.html',
  providers: [UserService, ManageDiscountCodeService, SubscriptionPriceService, LicenseService, ReportService]
})

export class AppComponent implements OnInit {
  
  public obj: any;
  public objMenu: any;
  public menustaus: string;
  public submenustaus: string;
  
  constructor(private userservice: UserService, public global: GlobalService, private router: Router
    ) { } 
  ngOnInit(): void {
    this.menustaus = "True";
    this.global.getJSON().subscribe(data => {
      this.obj = data["AdminSections"]
      for (let i = 0; i < 7; i++) {
       
        if (this.obj[i].Id == this.global.UserType) {
          this.objMenu = this.obj[i].HeaderMenu;
        }
      } 
    }, error => console.log(error));
    this.router.navigate(['/updateuserprofile']);
  }
  logout() {
    localStorage.removeItem('loggedInUserDetails');
    window.location.href = this.global.LiveURL; 
  }
  Product() {
    debugger;
  //localStorage.removeItem('loggedInUserDetails');
    window.location.href = this.global.LiveURL;
    //this.router.navigate([this.global.LiveURL]);
  }
}