Closed Jammooly1 closed 2 years ago
You have to keep the stuff in the callback i guess
user.auth(username, password, ()=>{
console.log('logged in')
console.log('user.is is ', user.is)
console.log('user object is ', user)
store.state.cur_user = true
});
This may help
there is a workaround for this though,
var userObj = JSON.parse(sessionStorage.getItem("pair"))
make sure to handle userObj.priv
(private key) safely
I have no idea if this is secure or recommended.
It just works :)
@Jammooly1 looks like @atordvairn helped? Thanks 👏 ! Closing. Please reopen if bug.
Hello Gun community, gunjs has been really cool to use but I have a problem validating whether a user is logged in because user.is is acting funny.
I'm calling
user.auth(username, password, ({err}) => err && alert(err));
in my code but right after this line, Iconsole.log(user.is)
and it says undefined. I know 100% that I'm entering the correct credentials, any thoughts on why user.is is showing undefined?For example, in my code below console.log prints
user.is is undefined
but in the next console.log line, there's another console.log line that prints the user object and it contains is along with the alias, pub, ... inside of it.Code above found here: https://github.com/Jammooly1/vue3-gunjs-Todo-App/blob/main/src/composables/useLogin.js
This is my project: https://github.com/Jammooly1/vue3-gunjs-Todo-App