Link to the widget after refresh - Shopify

Hi guys.
I need to fix this problem into my shop developed with Shopify-
When i upload the image via widget and if refresh the page, i loose the link to the widget to modify the image uploaded. So i need to show the link to modify the image if i refresh the page.
How is possible to solve this problem?

Check the screenshot here.

Check the second screenshot.


You can set a predefined value for the widget using the value() method: Default files in widget dialog

Also, you’ll need to save the URL of the last uploaded image for the current product. I think local storage can be a good fit for storing additional data such as image CDN URL.

So, the workflow will look like this:

  1. You check the widget’s value and if it’s null, do nothing. Otherwise, you look for the current product custom image CDN URL in local storage and set the value of the widget.
  2. After a user has uploaded an image, you save its CDN URL and current product name in local storage or update the existing record.

Hope that helps!