This commit is contained in:
Kenneth Jannette
2024-01-19 19:29:34 -06:00
parent 8a53417805
commit eb6ce27adf

View File

@@ -112,7 +112,7 @@ const SignupPage = () => {
const handleProceedToPayment = (e) => { const handleProceedToPayment = (e) => {
e.preventDefault(); e.preventDefault();
/*
if (isBusy) { if (isBusy) {
return; return;
} }
@@ -120,7 +120,6 @@ const SignupPage = () => {
if (dataValues === null) { if (dataValues === null) {
return; return;
} }
*/
setShowPaymentModal(true); setShowPaymentModal(true);
}; };
@@ -137,7 +136,29 @@ const SignupPage = () => {
if (paymentDataValues === null) { if (paymentDataValues === null) {
return; return;
} }
console.log("paymentDataValues", paymentDataValues); const dataValues = validateData();
if (dataValues === null) {
return;
}
setIsBusy(true);
const paymentSuccess = handleStripeAuthorization(paymentDataValues);
if (paymentSuccess) {
try {
const userCredential = await createUserWithEmailAndPassword(
auth,
dataValues.email,
dataValues.password
);
const user = userCredential.user;
await saveUserData(user.uid, dataValues);
navigate("/");
} catch (error) {
setIsBusy(false);
setNotice(
error.message || "Sorry, something went wrong. Please try again."
);
}
}
}; };
return ( return (