0
I’m building an Angular login system. The back-end is in cakephp. The request for preflight is being done correctly and receiving status 200 (figure below). After the preflight, the angle sends the empty POST request, without the login parameters. If I keep repeating the request, sometimes it sends the correct request. My job is the following::
SignIn(email = "", password = ""): Observable<Response> {
const api = environment.apiURL + "login";
const body = { email, password };
const options = { headers: this.headers };
return this.http.post<any>(api, body, options).pipe(
take(1),
tap(
(success) => this.processLogin(success)
error => console.error(error)
)
);}
On the console he tells me that it was a problem with CORS, but in cakephp it is enabled and as sometimes the request works correctly, I believe the problem is with the angular. Does anyone have any idea what I’m doing wrong?