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

43 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Component } from '@angular/core';
import { ServerService } from './services/server.service';
import { FieldBase } from '../app/form/fields/field-base';
import { JsonObjest } from '../app/entities/JsonObject.class';
2017-11-01 18:18:27 +01:00
import { TokenService, TokenProvider } from './services/login/token.service';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
@Component({
selector: 'app-root',
2017-11-01 18:18:27 +01:00
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: []
})
export class AppComponent {
fields: any[];
2017-11-01 18:18:27 +01:00
constructor(private tokenService : TokenService, private router: Router) {
}
//loggedInAs : string = null;
showLogin : boolean = false;
login(){
//redirect to login page
2017-11-02 10:11:29 +01:00
this.router.navigate(['/login'], { queryParams: { /*returnUrl: this.state.url*/ }});
2017-11-01 18:18:27 +01:00
}
logout(){
this.tokenService.logout();
2017-11-02 10:11:29 +01:00
this.router.navigate(['/login'], { queryParams: { /*returnUrl: this.state.url*/ }});
2017-11-01 18:18:27 +01:00
}
}
2017-11-01 18:18:27 +01:00