I have fetched an API request and now access the values in the array I'm having issues. I see that all the objects are successful in the PromiseResult. But if I try object[0].propertyName I get it cannot be read.
Here is my full method and some stuff i tried.
methods: {
fetchByteArray() {
this.post = true;
this.loading = false;
//Docs\003
console.log("inside FetchByteArray");
fetch('https://localhost:5001/api/Doc/GetFolder/003')
.then(response => {
console.log(response.json());
//console.log(JSON.stringify(response));
//console.log(response.body);
let result = Promise.resolve(response);
result.then(val => console.log(val));
})
.then(bytes => {
//console.log(bytes);
//this.byteArrays = bytes;
console.log(bytes.fileName);
})
.catch(error => console.log(error.message));
[[PromiseResult]]
:
Array(6)
0
:
{fileID: 0, fileName: 'image00.png', fileExtension: '.png', filePath: 'C:\\Users\\user1\\Documents\\zTests\\Docs\\003', byteArray: 'System.IO.MemoryStream', …}
1
:
{fileID: 1, fileName: 'image01.png', fileExtension: '.png', filePath: 'C:\\Users\\user2\\Documents\\zTests\\Docs\\003', byteArray: 'System.IO.MemoryStream', …}