144. Adding header type (#18)

This commit is contained in:
Art
2021-09-17 21:24:01 +03:00
parent ca40d4cc4a
commit c0cbe7fa5a
2 changed files with 6 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import {Subscription} from "rxjs";
import {UserLogin} from "../../dto/user-login";
import {HttpErrorResponse, HttpResponse} from "@angular/common/http";
import {User} from "../../model/user";
import {HeaderType} from "../../enum/header-type.enum";
@Component({
selector: 'app-login',
@ -39,7 +40,7 @@ export class LoginComponent implements OnInit, OnDestroy {
.login(userLogin)
.subscribe((response: HttpResponse<User>) => {
const token = response.headers.get("Jwt-Token");
const token = response.headers.get(HeaderType.JWT_TOKEN);
this.authenticationService.saveToken(token!);
this.authenticationService.addUserToLocalStorage(response.body!);

View File

@ -0,0 +1,4 @@
export enum HeaderType {
AUTHORIZATION = 'Authorization',
JWT_TOKEN = 'Jwt-Token'
}