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'; 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'; import { AutocompleteRemoteComponent } from './form/fields/autocomplete-remote/autocomplete-remote.component'; declare var $ :any; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], providers: [] }) export class AppComponent implements OnInit { fields: any[]; sliderExpanded : boolean = false; constructor(private tokenService : TokenService, private router: Router) { } ngOnInit() { } slideNav(){ $("#appSidebar").toggleClass("expanded"); $("#appBody").toggleClass("expanded"); } //loggedInAs : string = null; showLogin : boolean = false; login(){ console.log("navigating to login") //redirect to login page this.router.navigate(['/login'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ }}); location.reload(); } logout(){ this.tokenService.logout(); this.router.navigate([''], { queryParams: { /*returnUrl: this.state.url*/ }}); location.reload(); } }