I am encountering issues accessing object properties, as they keep returning as undefined.
I have attempted
console.log(JSON.parse(this.$store.state.user.userId));
as well as
console.log(JSON.parse(this.$store.state.user[0].userId));
However, when I execute
console.log(JSON.parse(this.$store.state.user.userId));
I receive the error message
"SyntaxError: Unexpected token u in JSON at position 0"
When I simply use
console.log(JSON.parse(this.$store.state.user));
The object is displayed and I can see the properties. The issue arises when attempting to access them, resulting in undefined
.