Com este import do angular, a requisição não chega no servidor, e com este método:
import { HttpClient, HttpHeaders } from '@angular/common/http';
login(user: User) {
let header: HttpHeaders = new HttpHeaders();
header = header.append('Content-Type', 'application/json');
return this.http.post(`${USUARIOS_API}/api/auth`, user, {headers: header});
}
Com esta importação e com este método a requisição vai ao servidor:
private headers = new Headers({
'Content-Type': 'application/json'
});
import { Http, Headers, Response } from '@angular/http';
login(usuario: Usuario): Observable<boolean> {
this.http.post(this.base, JSON.stringify({login: usuario.login, senha: usuario.senha}), {headers: this.headers});
}
Além de um ser Http e outro ser HttpClient, porque um chega e outro não ?