Please help with this problem I'm trying to show registers from an api route (/api/orders) When I call them from axios, I use get petittion to /api/orders
This is my method:
`listarOrdenesIngreso (page,buscar,criterio){
let me=this;
var url= '/api/orders?page=' + page + '&buscar='+ buscar + '&criterio='+ criterio;
axios.get(url)
.then(function (response) {
var respuesta= response.data;
me.arrayOrders = respuesta.orders.data;
me.pagination = respuesta.pagination;
// handle success
})
`........
Here is the API route routes/api.php file
Route::resource('orders', 'EntryOrderController',['except' => ['create','edit']]);
and here the code of controller (EntryOrderController.php file)
public function index(Request $request)
{ if (!$request->ajax()) return redirect('/');
$entries = EntryOrder::all();
//return response()->json(['data' => $entries], 200);
return $this->showAll($entries);
}
The problem It shows in image 1, where not show any register in my vue component When I call them from the URL in the browser, show me correctly the array with data.
I hope you can help me Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire