async getPosts () {
let endpoint = 'api/informationobjects';
let baseUrl = corsUrl + atomUrl + endpoint;
let headers = {'Authorization': 'Basic ' + btoa('myemail...@myurl.co.uk:mypassword')}; // this retrieves json from the api fine whether I'm logged into atom or not. If logged in I can display the digital objects in the app, however, if not logged in we still get a path to a digital object, as you say in your reply above, but for each digital object we get a 404 error (see details below)
let headers = {'Authorization': 'REST-API-Key:myRestApiKey'}; // this returns a 401 error regardless of whether I'm signed into atom or not and doesn't retrieve any json (see details below)
axios.get(baseUrl, {headers})
.then(response => {
const promises = response.data.results
.map(item => axios.get(`${baseUrl}/${item.slug}`, {headers}));
Promise.all(promises)
.then(posts => this.setState({posts}))
.catch(error => console.log(error));
});
}