I am trying to prevent from having to call the fetch for the profile pic upon loading the page. I get the image as a blob, and I convert it into an object url and then store it in the local storage. I noticed that upon refreshing the page the image is erroring out and I am not sure why that is the case, does the object url not save in local storage? If so how can I save the data for the image?
axios({
url: '/users/avatar',
method: 'GET',
headers: {
'Authorization': "Bearer " + token,
},
data: {avatar: avatarUrl},
responseType: 'blob',
}).then((response) => {
log(response);
let blob = URL.createObjectURL(response.data)
localStorage.setItem('image', blob);
}