[Vuejs]-Vue: how to access user info from local storage

0๐Ÿ‘

โœ…

Try this:

console.log(JSON.parse(sessionstore.user).role)

You stored your data with JSON.stringify so you have to parse your data!

0๐Ÿ‘

The syntax for reading the sessionStorage item is as follows:

sessionStorage.getItem('key');

docs

Leave a comment