You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
import { Router } from '@angular/router';
|
|
|
|
import { routes } from '../../../../consts';
|
|
import { User } from '../../../../pages/auth/models';
|
|
import { MenuService } from 'src/app/_providers/_services/menu.service';
|
|
|
|
@Component({
|
|
selector: 'app-user',
|
|
templateUrl: './user.component.html',
|
|
styleUrls: ['./user.component.scss']
|
|
})
|
|
export class UserComponent {
|
|
@Input() user: User;
|
|
@Output() signOut: EventEmitter<void> = new EventEmitter<void>();
|
|
signedOut : boolean
|
|
public routes: typeof routes = routes;
|
|
public flatlogicEmail: string = "https://flatlogic.com";
|
|
adminUser: boolean = false;
|
|
username: string;
|
|
secuLevel: string;
|
|
|
|
public signOutEmit(): void {
|
|
localStorage.removeItem('emailId')
|
|
this.signOut.emit();
|
|
if(this._router.url == '/auth/login' || this._router.url == '/auth/admin-home')
|
|
this.signedOut = true
|
|
console.log('user==email======',this._router);
|
|
|
|
}
|
|
constructor(public _router : Router){
|
|
// console.log('user==email======',this._router);
|
|
|
|
}
|
|
|
|
ngOnInit(){
|
|
this.getUser();
|
|
this.getEmail();
|
|
}
|
|
getUser(){
|
|
this.secuLevel = localStorage.getItem('seculevel')
|
|
if(this.secuLevel && this.secuLevel == 'B'){
|
|
|
|
if(this.secuLevel === 'B'){
|
|
this.adminUser = true
|
|
}
|
|
else{
|
|
this.adminUser= false
|
|
}
|
|
// this.cdr.detectChanges();
|
|
}
|
|
this.username = localStorage.getItem('username')
|
|
if(this.username)
|
|
return this.username
|
|
else
|
|
return ''
|
|
}
|
|
getEmail(){
|
|
let email = localStorage.getItem('emailId')
|
|
if(email)
|
|
return email
|
|
else
|
|
return ''
|
|
}
|
|
}
|