144. Adding header type (#18)
This commit is contained in:
@ -7,6 +7,7 @@ import {Subscription} from "rxjs";
|
|||||||
import {UserLogin} from "../../dto/user-login";
|
import {UserLogin} from "../../dto/user-login";
|
||||||
import {HttpErrorResponse, HttpResponse} from "@angular/common/http";
|
import {HttpErrorResponse, HttpResponse} from "@angular/common/http";
|
||||||
import {User} from "../../model/user";
|
import {User} from "../../model/user";
|
||||||
|
import {HeaderType} from "../../enum/header-type.enum";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
@ -39,7 +40,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
.login(userLogin)
|
.login(userLogin)
|
||||||
.subscribe((response: HttpResponse<User>) => {
|
.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.saveToken(token!);
|
||||||
|
|
||||||
this.authenticationService.addUserToLocalStorage(response.body!);
|
this.authenticationService.addUserToLocalStorage(response.body!);
|
||||||
|
|||||||
4
support-portal-frontend/src/app/enum/header-type.enum.ts
Normal file
4
support-portal-frontend/src/app/enum/header-type.enum.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export enum HeaderType {
|
||||||
|
AUTHORIZATION = 'Authorization',
|
||||||
|
JWT_TOKEN = 'Jwt-Token'
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user