Hi i' m doing an axios request to get the image but response parametrs cannot be assigned to any kind of variable but i can read them in console.log Where I'm wrong?
let string = null;
axios.get('/images/0dace5ee-1be7-4d2c-a07fb03927096815')
.then(res =>{
console.log(res.data) //returns the value of the binary
console.log(res.headers['content-type']);//returns the current type image/png
string = 'data:'+res.headers['content-type']+';base64,'+ btoa(res.data);
})
.catch(error => {
console.log(error)
})
console.log(string)//returns null