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

60 lines
1.4 KiB
TypeScript
Raw Normal View History

2017-11-02 15:19:12 +01:00
import { Component, OnInit} 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';
2017-11-03 18:57:06 +01:00
declare var $ :any;
@Component({
selector: 'app-root',
2017-11-01 18:18:27 +01:00
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: []
})
2017-11-02 15:19:12 +01:00
export class AppComponent implements OnInit {
fields: any[];
2017-11-03 18:57:06 +01:00
sliderExpanded : boolean = false;
2017-11-01 18:18:27 +01:00
constructor(private tokenService : TokenService, private router: Router) {
}
2017-11-02 15:19:12 +01:00
ngOnInit() {
}
2017-11-01 18:18:27 +01:00
2017-11-03 18:57:06 +01:00
slideNav(){
$("#appSidebar").toggleClass("expanded");
$("#appBody").toggleClass("expanded");
}
2017-11-01 18:18:27 +01:00
//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