Reputation: 517
I'm returning an object from an API(Amazon MWS) call. I am able to pass this data to a vue instance within the same php file as a prop and display the results. Although this is just for test purposes and isn't very flexible.
What is the best way to handle a situation like this? Should I store the data from this object to a database, make a call from the vue instance to the database? If so how do I go about this? If not what are the best alternatives to handle passing data from an API call?
Thanks!
Upvotes: 0
Views: 83
Reputation: 50797
Create an API that sits in front of their API. Return what you want from your API after making a call to their API.
public function getProduct($pid)
{
$product = $this->mwsservice->getProduct($pid);
return response()->json($product);
}
Then call this function from vue when you want the data, make sure you have a Laravel route setup for it.
Upvotes: 1