I need to save a dataset through an API.
I tried to pass the data in different ways but I was not successful. Always gives the error:
ERROR Error: Uncaught (in promise): HttpErrorResponse: {"headers": {"normalizedNames": {}, "lazyUpdate": null}, "status": 404, "statusText" url ":
Follow the code below.
//metodo para salvar os dados ao fazer o submit
async onCheck() {
console.log(this.eventGuest);
this.eventService.saveInvite(this.events,this.eventGuest);
}
//metodo para fazer a requisição no endpoint
saveInvite(id_events, eventGuest):Promise<any>{
return new Promise((res,rej)=>{
this.http.post(environment.apiUrl+'api/event/'+id_events+'/invite', eventGuest).then((response)=>{
res(response);
}).catch((err)=>{
rej(err);
});
}
//caminho da rota da api feita no Laravel
Route::post('/event/{event}/invite','EventController@invite')->middleware('auth:api');