more
This commit is contained in:
@@ -14,8 +14,9 @@ const PaymentModal = ({
|
||||
paymentfields,
|
||||
handleChangePaymentInput,
|
||||
modalText,
|
||||
handleSignup,
|
||||
handleSignUp,
|
||||
setShowPaymentModal,
|
||||
handleSignup,
|
||||
}) => {
|
||||
const fieldsChunkSize = 2;
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ const SignupPage = () => {
|
||||
};
|
||||
|
||||
const validatePaymentData = () => {
|
||||
const newPaymentData = getValidatedFormData(data, paymentfields);
|
||||
console.log("paymentData", paymentData);
|
||||
const newPaymentData = getValidatedFormData(paymentData, paymentfields);
|
||||
const hasErrors = isFormDataHasErrors(newPaymentData);
|
||||
setPaymentData(newPaymentData);
|
||||
return hasErrors ? null : objectMap(({ value }) => value, newPaymentData);
|
||||
@@ -122,6 +123,7 @@ const SignupPage = () => {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
setShowPaymentModal(true);
|
||||
};
|
||||
|
||||
@@ -131,35 +133,13 @@ const SignupPage = () => {
|
||||
// handle failure
|
||||
}
|
||||
|
||||
const handleSignUp = async (e) => {
|
||||
const handleSignup = async (e) => {
|
||||
e.preventDefault();
|
||||
const paymentDataValues = validatePaymentData();
|
||||
if (paymentDataValues === null) {
|
||||
return;
|
||||
}
|
||||
const dataValues = validateData();
|
||||
if (dataValues === null) {
|
||||
return;
|
||||
}
|
||||
setIsBusy(true);
|
||||
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."
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log("paymentDataValues", paymentDataValues);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -264,7 +244,7 @@ const SignupPage = () => {
|
||||
paymentfields={paymentfields}
|
||||
setShowPaymentModal={setShowPaymentModal}
|
||||
handleChangePaymentInput={handleChangePaymentInput}
|
||||
handleSignUp={handleSignUp}
|
||||
handleSignup={handleSignup}
|
||||
modalText={modalText}
|
||||
/>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user