前端
报错

Service 代码
environment.API_URL = 'http://localhost:8080'
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
})
};
@Injectable({
providedIn: 'root'
})
export class LoginService {
private loginVerifyUrl = '/user/verify';
private fetchALL = '/user/fetch-all';
constructor(private http: HttpClient) { }
verifyLogin(email: string, password: string): Observable<any> {
return this.http.post<LoginToken>(environment.API_URL + this.loginVerifyUrl, {email, password}, httpOptions);
}
}
Consume 代码
onSubmit() {
this.token.email = this.emailFormControl.value;
this.token.password = this.passwordFormControl.value;
this.loginService.verifyLogin(this.token.email, this.token.password).subscribe( data => {
console.log(data, 'is what we got from the server');
});
}
后端
函数签名

运行 console
