Attempting to call a data source from a remote URL results in the error
TypeError: Cannot read property 'map' of undefined
. The axios method is enclosed within axios.js
:
.....
result = new Promise((resolve, reject) => {
axios.get(url)
.then((response) => {
const processedData = response.data.response.map((v) => {
return v;
})
resolve(processedData);
}).catch((error) => {
if(typeof(error) == 'object'){
alert(error) // @@@ I ALWAYS LAND HERE
}
reject(error.data);
});
});
....
Verification in the network console confirms that the API URL being accessed is functioning properly and all data can be viewed. The format of the API is as follows:
[
{
"id": 1,
"name": "alpha",
"build_id": 50,
"app_env_names": "",
"app_env_list": [
""
],
},
{
"id": 2,
"name": "feature/OPS-05",
"build_id": 48,
"image_tag": "feature_DEVOPS-605-jasc-cr-approval-test-71496674-48",
"app_env_names": "dev",
"app_env_list": [
"dev"
],
.....
Attempts to remove map have been unsuccessful. Seeking advice on resolving this issue. Thank you!