diff --git a/web/angular/src/app/header/header.component.html b/web/angular/src/app/header/header.component.html index e300236..2c40686 100644 --- a/web/angular/src/app/header/header.component.html +++ b/web/angular/src/app/header/header.component.html @@ -1,27 +1,45 @@ diff --git a/web/angular/src/app/header/header.component.ts b/web/angular/src/app/header/header.component.ts index 625ee17..014af22 100644 --- a/web/angular/src/app/header/header.component.ts +++ b/web/angular/src/app/header/header.component.ts @@ -1,4 +1,8 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; +import {BehaviorSubject} from "rxjs/BehaviorSubject"; +import {AuthService, AuthState} from "../auth.service"; +import {User} from "../../api/models/user.model"; +import {ConsoleService} from "../console.service"; @Component({ selector: 'app-header', @@ -8,9 +12,39 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; }) export class HeaderComponent implements OnInit { - constructor() { } + AuthState = AuthState; + + login: string; + password: string; + + constructor(private consoleService: ConsoleService, private authService: AuthService) { } ngOnInit() { + this.login = this.authService.getLogin(); } + getUser(): BehaviorSubject { + return this.authService.user; + } + + getAuthState(): BehaviorSubject { + return this.authService.state; + } + + getError(): BehaviorSubject { + return this.authService.error; + } + + requestLogin(): void { + this.authService.setCredential(this.login, this.password); + this.authService.requestLogin(); + } + + requestLogout(): void { + this.authService.requestLogout(); + this.login = null; + this.password = null; + } + + } diff --git a/web/angular/src/app/login/login.component.html b/web/angular/src/app/login/login.component.html index ccee111..4ccce58 100644 --- a/web/angular/src/app/login/login.component.html +++ b/web/angular/src/app/login/login.component.html @@ -28,7 +28,7 @@
- +
@@ -42,4 +42,4 @@
- \ No newline at end of file +