I am getting a JSON from an API call via axios and currently displaying the JSON using vue.
Here's my JSON Object from the console:
0:
category_id: "categ1"
item_name: "item1"
price: 100
stock: 155
1:
category_id: "categ2"
item_name: "item2"
price: 100
stock: 155
2:
category_id: "categ1"
item_name: "item3"
price: 100
stock: 155
3:
category_id: "categ3"
item_name: "item4"
price: 100
stock: 155
Here's my vue mounted function (i am using axios):
mounted () {
axios.get('link_for_api_endpoint', {
headers : {
Authorization: 'Bearer ' + access_token,
},
params: {
limit: 250
}
})
.then((response) => {
this.data = response.data.items;
//console.log(response);
$("#ldr").hide();
removeLoader();
})
.catch(function (error) {
console.log(error);
})
.then(function () {
});
}
What I want to do is I want to only get the data that has a category value "categ1" instead of the whole json object. How do i achieve this?