Utilizing vue to send http requests and store data in variables can be done like so: the api response will have the following structure:
data:
data: [id:1... etc]
function:
fetchOffers() {
this.$http.get('http://127.0.0.1:8000/api/offers')
.then(response => response.json())
.then(result => this.offers = result.data)
},
everything seems to be working fine,
Now, when using Laravel resource, the response may look like this:
data:
data: [id:1... etc]
links: [...]
meta: [...]
attempting to assign these properties to other variables does not seem to work as expected. Only the first variable gets assigned while the remaining two are left empty:
fetchOffers() {
this.$http.get('http://127.0.0.1:8000/api/offers')
.then(response => response.json())
.then(result => this.pagination = result.meta)
.then(result => this.links = result.links)
.then(result => this.offers = result.data)
},
if you have any insights on why this might not be working, or suggestions on how to approach it differently, your input would be greatly appreciated.