1
To fix Cors failure in the Laravel api I used the package Laravel Cors and followed everything that was reported in readme, but now it is returning an error to me when making a request http
post
Error:
POST http://127.0.0.1:8000/hqi/lecture 419 (Unknown status)
Controller
concerning the request:
public function store(Request $request)
{
$palestras_divulgacao = new palestras_divulgacao;
$palestras_divulgacao->fill($request->all());
$palestras_divulgacao->save();
return response()
->json($palestras_divulgacao, 201);
}
Calling for http
post
Angular on the client side:
public registrarPalestra(p: palestras): Observable<number> {
let headers: Headers = new Headers()
headers.append('Content-type', 'aplication\json')
return this.http.post(
`${URL_API}palestra`,
JSON.stringify(p),
new RequestOptions({headers: headers})
).pipe(map(response => response.json().id));
}
I appreciate the help
– Thayller vilela cintra