import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { OidcSecurityService } from 'angular-auth-oidc-client';
import { empty } from 'rxjs';
import { isEmpty } from 'rxjs/operators';
import { StateService } from './state.service';

@Injectable({
  providedIn: 'root'
})
export class AuthServiceService {


  constructor(private oidcSecurityService: OidcSecurityService,private stateService: StateService) {}

  login() {
    this.oidcSecurityService.authorize();
  }

  loggedIn() {
    const token = this.oidcSecurityService.getToken();
    if(token.length > 0){
      return true;
    }
    return false;
  }

  logOut() {
    this.oidcSecurityService.logoff();
  }
}
