When upload metadata, url doesn't update

Hi all, I’m trying to upload metadata to ipfs. I am using localStorage and document.cookie to get the url and save it in mysql. In the first try, the url is null and in the other attempts, the url comes with the previous value. How can i update and get last value ?

async function uploaddata(data) {
const buft = buffer.Buffer(JSON.stringify(data));
ipfs.add(buft, (err, result) => { // Upload buffer to IPFS
if (err) {
var dataurl = https://ipfs.io/ipfs/${result[0].hash};
console.log(“Metadata Loaded”, dataurl)
localStorage.setItem(“baltar”, dataurl);
document.cookie = “meta_url=”;
var sevecen = “meta_url=”+dataurl;
return “meta_url=”+dataurl;

1 Like

Hi @Broncoteam, I see one problem:

localStorage.setItem(“baltar”, dataurl);

the two item keys are different?

hi @chris.paterson , thank you for your attention.
yes, this two item keys are different. ‘daltar’ is img_url data and i’m removing it after create metadata finished. ‘baltar’ is metadata url key…

Hi @Broncoteam, ah I see. I’m not sure there’s enough code here for me to really understand what’s happening. Can you provide a link to the bigger picture? Perhaps a github repo?