mercredi 24 avril 2019

Angular 7.2 HttpClient delete method not work, send Options method instead

I'm interacting with a Laravel API from Angular 7.2 component, all methods works fine except delete, I can see thru Firefox network activity console that when trigger the function, the request is sent with OPTIONS method.

This is my service method:

elimina( id:number ) {
return this._http.delete( this.apiFMX + '/users/' + id );}

And in my component:

eliminaElemento( id:number ) {
this.dataService.elimina( id ).subscribe();
this.ruta.navigateByUrl( '/fmx-listado' );}

But it doesn´t work, here the console output:

enter image description here

Aditional I have added Cors Middleware in my Laravel API. Also, if the request is edited in the firefox console updating OPTIONS to DELETE method, it works.

Any suggestion?

Thanks in advise.



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2GzC2H3
via IFTTT

Aucun commentaire:

Enregistrer un commentaire