[Vuejs]-I keep getting this error in my console everything i visit this route

0πŸ‘

βœ…

I guess the state.user is already a object therefore you don’t need to use JSON.parse since JSON.parse() converts the input into a string. The toString() method of JavaScript objects by default returns [object Object], resulting in the observed behavior.

Try removing that such that your code should be

const getters = {
       isLoggedIn: (state) => !!state.token,
       getUser: (state) => state.user,
       getToken: (state) => state.token,
    };

Leave a comment