I'm trying to get a value from localStorage to determine the value of a variable in store. I remember trying something similar with vuejs about a year ago and it seemed to work. I also have no issues with this on Reactjs. But for some reason i keep getting this error when doing the same in Nuxt
this is my user.js file
export const state = () => ({
isLoggedIn: !!localStorage.getItem('userDetails')
})
export const mutations = {
login(state) {
state.isLoggedIn = true;
},
logout(state) {
window.localStorage.clear()
state.isLoggedIn = false;
}
}
am i approaching this problem wrong? or is this not supposed to work? Any help is appreciated.

