I try to follow some tutorial on youtube, and trying to build an admin dashboard the tutorial uses some dummy data for the portal
export const ordersData = [
{
OrderID: 10248,
CustomerName: 'Vinet',
},
{
OrderID: 345653,
CustomerName: 'Carson Darrin',
}, etc...
i try to replicate with the real API interaction
export const ordersData = fetch('API_URL', {method:"GET"})
.then(res => {
return res.json();
}).then(data => {
console.log(JSON.parse(data.body))
return JSON.parse(data.body)
})
but its seems not to work as expected, i try to compare the console.log with the directly input data they look the same in the console, both of them are shown as objects (typeof).
not sure which step is going wrong