0
I need to save a data set through an API.
I tried to pass the data in several ways but did not succeed. Always gives the error:
ERROR Error: Uncaught (in Promise): Httperrorresponse: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":404,"statusText":"Not Found","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');
Status 404 means route not found. Check your URL.
– Marconi