I watched the tutorial. It seems the user keeps logged in when I use meteor account-ui. But when I use this code to login with my own ui:
if ( this.loginForm.valid ) {
Meteor.loginWithPassword(this.loginForm.value.email,
this.loginForm.value.password,
(error) => {
if ( error ) {
alert(error);
} else {
alert('login success');
this.router.navigate( ['/dashboard/home'] );
}
})
}
Then when I refresh the page and I check the Meteor.user(), it returns null. What is the best way to keep the user logged-in? Thanks.