I have this function, it calls Google social login
loginnn($event){
this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID);
this.socialAuthService.authState.subscribe((user) => {
this.frmLoginGoogle.patchValue({
email: user.email,
googleAuthToken: user.authToken,
});
console.log('loop after clicking again')
});
this.loginGoogle($event);
console.log('execute the function first than the one above')
}
the problem is that it runs this.loginGoogle before the this.socialAuthService
I already tried to put this.loginGoogle inside subscribe, but it ends up running several times after a few clicks
I think this is the right way to do it.