DEV Community

Alam487
Alam487

Posted on

How to fix local storage issue in vue_form_generator

I am using local storage in vue form generator where I am storing the user entered value temporary in a browser. So after submitting the form local storage value will vanish completely.
But in my case I have some issues Like in our site we have two different user One is business user and other is personal user So the issue is If we are storing the local storage value in business login user and if we logout from the session and we will login with different user as personal user Then the same value is displaying in other logged in user. So how to prevent this in vfg.
Here is my code which I have implemented.

if (localStorage.getItem('model') !== null)
            this.model=JSON.parse(localStorage.getItem('model'));
  },
Enter fullscreen mode Exit fullscreen mode
localStorage.setItem('model', JSON.stringify(this.model));
Enter fullscreen mode Exit fullscreen mode

Using vfg model I am saving the value in local storage. So please if anyone Have an Idea please help me

Top comments (0)