diff --git a/client/src/pages/SignUp/index.jsx b/client/src/pages/SignUp/index.jsx index 3a98e13..f84103b 100644 --- a/client/src/pages/SignUp/index.jsx +++ b/client/src/pages/SignUp/index.jsx @@ -32,7 +32,7 @@ export default function SignUpPage() { } /** - * Holds the form state and validates the form. + * Holds the form state and validates the form. TODO: use an alert to display errors. */ const SignUpFormBase = (props) => { const [userName, setUserName] = useState(""); @@ -62,6 +62,17 @@ const SignUpFormBase = (props) => { .catch((err) => setError(err)); }; + const handleClick = (e) => { + e.preventDefault(); + auth + .signInWithGoogle() + .then(() => { + cleanFields(); + props.history.push(ROUTES.APP); + }) + .catch((err) => setError(err)); + }; + const isInvalid = password1 !== password2 || password1 === "" || @@ -101,6 +112,9 @@ const SignUpFormBase = (props) => { > Sign Up + {error &&
{error.message}
} diff --git a/client/src/services/auth/firebase.js b/client/src/services/auth/firebase.js index f2c51d6..e5a598c 100644 --- a/client/src/services/auth/firebase.js +++ b/client/src/services/auth/firebase.js @@ -24,7 +24,10 @@ export default class Firebase { provider = new app.auth.GoogleAuthProvider(); - signInWithGoogle = () => this.auth.signInWithPopup(this.provider); + signInWithGoogle = () => + this.auth + // signInWithRedirect(this.provider); + .signInWithPopup(this.provider); createUserWithEmailAndPassword = (email, password) => this.auth.createUserWithEmailAndPassword(email, password);