This commit is contained in:
Kenneth Jannette
2024-01-19 18:00:10 -06:00
parent 670b76a607
commit 7b0255374c

View File

@@ -109,16 +109,18 @@ const SignupPage = () => {
if (isBusy) {
return;
}
const dataValues = validateData();
if (dataValues === null) {
return;
}
setShowPaymentModal(true);
};
async function handleStripeAuthorization() {}
async function handleStripeAuthorization(paymentDataValues) {
//Do calls to Stripe API
// if success, return some truthy value or
// handleFailure()
}
const handleSignUp = async (e) => {
e.preventDefault();
@@ -130,22 +132,24 @@ const SignupPage = () => {
if (dataValues === null) {
return;
}
//const paymentSuccess = handleStripeAuthorization(paymentDataValues)
setIsBusy(true);
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."
);
const paymentSuccess = "true"; // 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."
);
}
}
};