_DEMONOriginal post
Web Developer
I am trying to create an account with google sign in , the account is getting created but i am not able to log it to console and the dispatch method is also not working
const signupWithGoogle = async () => {
try {
const userData = await authService.OAuth2Login();
if (userData) {
const userData = await authService.getCurrentUser();
console.log(userData);
if (userData) dispatch(login(userData));
navigate("/");
}
} catch (error) {
setError(error.message);
}
};
async OAuth2Login(provider) {
try {
const user = await this.account.createOAuth2Session(OAuthProvider.Google, "http://localhost:5173");
return user;
} catch (error) {
throw error;
}
}
Summary
Issue: Unable to log account creation with Google Sign In to console, and dispatch method is not working after account creation.
Solution: It seems like there might be a variable redeclaration issue with `userData`. Try renaming the variable in the relevant if block. Additionally, check if `dispatch` is correctly set up in the function scope.