im trying to use a primeblocks component and i need to v-bind a the dataTable to the response from my api
this is where im stuck: when i console.log(productData) i get an array containing the array of all my products which came from my api instead of a regular array
<template>
<div>
<DataTable :value="productData" responsiveLayout="scroll">
<Column field="SKU" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="brand" header="Brand"></Column>
<Column field="color" header="Color"></Column>
</DataTable>
</div>
</template>
<script>
import axios from 'axios';
let productData = [];
export default {
data() {
return {
productData: null
}
},
mounted() {
const loadProducts = async () => {
const response = await axios.get("http://localhost:1337/products")
productData.value = response.data.products;
};
loadProducts()
}
}
console.log(productData)
</script>
this is my console.log
[]
value: (87) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
length: 0
[[Prototype]]: Array(0)
im clearly doing something wrong, if anyone can point me in the right direction that would be awesome