Angular 角度7-标头中的数据返回null

Angular 角度7-标头中的数据返回null,angular,Angular,我在angular 7开发的应用程序中有一个身份验证服务代码。我需要恢复API头中发送的数据,但这些数据是空的 这是身份验证服务: import {Injectable} from '@angular/core'; import {HttpClient, HttpResponse, HttpHeaders} from '@angular/common/http'; import {BehaviorSubject, Observable} from 'rxjs'; import {map} fro

我在angular 7开发的应用程序中有一个身份验证服务代码。我需要恢复API头中发送的数据,但这些数据是空的

这是身份验证服务:

import {Injectable} from '@angular/core';
import {HttpClient, HttpResponse, HttpHeaders} from '@angular/common/http';
import {BehaviorSubject, Observable} from 'rxjs';
import {map} from 'rxjs/operators';
import {User} from '../../models/index';
import {global} from '../global';

@Injectable({providedIn: 'root'})

export class AuthenticationService {
    private currentUserSubject: BehaviorSubject<User>;
    public currentUser: Observable<User>;

    constructor(private http: HttpClient) {
        this.currentUserSubject = new BehaviorSubject<User>(JSON.parse(localStorage.getItem('currentUser')));
        this.currentUser = this.currentUserSubject.asObservable();
    }

    public get currentUserValue(): User {
        return this.currentUserSubject.value;
    }

    login(email: string, password: string): Observable<HttpResponse<any>> {
        return this.http.post(`${global.URL}/user/login`, {email, password}, {observe: 'response'});
    }

    logout() {
        localStorage.removeItem('currentUser');
        this.currentUserSubject.next(null);
    }
}
响应如下

这是标题

我需要找回代币,但这个没有来

import {Component, OnInit} from '@angular/core';
import {FormControl, FormGroup, Validators, FormBuilder} from '@angular/forms';
import {User} from '../../models/index';
import {Router, ActivatedRoute} from '@angular/router';
import {AuthenticationService} from '../../services/index';
import {first} from 'rxjs/operators';


@Component({
    selector: 'app-login',
    templateUrl: './login.component.html',
    styleUrls: ['./login.component.scss']
})

export class LoginComponent implements OnInit {

    loginForm: FormGroup;
    model: User;

    constructor(private route: ActivatedRoute, private router: Router, formBuilder: FormBuilder, private authenticationService: AuthenticationService) {
        this.model = new User();
        this.loginForm = formBuilder.group({
        email: new FormControl(this.model.email, [Validators.required, Validators.email]),
        password: new FormControl(this.model.password, [Validators.required]),
        });
    }


    ngOnInit() {
        this.authenticationService.logout();
        this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
    }

    submitForm() {
        if (this.loginForm.invalid) {
            return;
        }
        this.authenticationService.login(this.form.email.value, this.form.password.value)
            .subscribe(
                data=>{
                    console.log(data);
                },
                error=>{
                    console.log(error)
                }
             }

    }
}