argos/dmp-admin/src/app/app.component.ts

60 lines
1.1 KiB
TypeScript

import { Component } from '@angular/core';
import { TokenService, TokenProvider } from './services/login/token.service';
import {Router} from '@angular/router';
import '../assets/custom.js';
declare function sign_out_google(): any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(private tokenService : TokenService, private router: Router) {
}
//loggedInAs : string = null;
showLogin : boolean = false;
authenticateToServer(tokenInfo){
console.log("Running authenticateToServer");
console.log(tokenInfo);
//backendURL, token
//return this.tokenService.authenticate_backend(backendURL, token);
}
logout(){
//set the log out actions here
this.tokenService.setLoggedIn(false);
this.tokenService.setEmail(null);
this.tokenService.setUsername(null);
this.tokenService.setToken(null);
if(this.tokenService.getProvider() == TokenProvider.google){
sign_out_google();
}
this.tokenService.setProvider(null);
}
}