You can view your local storage in DevTools to see if your set to local storage is working and the value is what you expect. If not, debug how you are setting the value. If so, then it's your local storage fetch that's the issue.
Be aware that all local storage is stored as strings; so if you are trying to store complex structures they need to be serialized. JSON is the usually technique for that.