0👍
while there is no access_token
in your local storage then localStorage.getItem('access_token')
will return the value undefined
which is not equal to null in non-strict not version !=
so you getter will be always true
instead, you should use (strict not version) or (double not version ):
option 1 :
getters:{
isLoggedIn(state){
return state.Token !== null; //double equals
}
}
option 2 :
getters:{
isLoggedIn(state){
return !!state.Token; // double !
}
}
Source:stackexchange.com