1

Please tell me, I am working with the ual-anchor library for authorization, as well as with ual-plainjs-renderer for rendering a modal authorization window. My problem is to store an instance of the UALJS class in local storage (or somewhere else) so that I can access this class even after a page reload.

dsanich
  • 31
  • 3

2 Answers2

1

You are limited to store string key/value pairs in localstorage. The only option is to use JSON.stringify() and JSON.parse(obj)

checkout this thread:

https://stackoverflow.com/a/2010948/12165605

AG_1380
  • 552
  • 5
  • 12
0

Try using localStorage like this--

localStorage.setItem("class", JSON.stringify(class));
let class = JSON.parse(localStorage.getItem("class"))
localStorage.removeItem("class");
Justin Meskan
  • 618
  • 1
  • 9
  • 32