more
This commit is contained in:
@@ -58,6 +58,13 @@ const SignupPage = () => {
|
|||||||
return hasErrors ? null : objectMap(({ value }) => value, newData);
|
return hasErrors ? null : objectMap(({ value }) => value, newData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const validatePaymentData = () => {
|
||||||
|
const newData = getValidatedFormData(data, signupfields);
|
||||||
|
const hasErrors = isFormDataHasErrors(newData);
|
||||||
|
setPaymentdata(newData);
|
||||||
|
return hasErrors ? null : objectMap(({ value }) => value, newData);
|
||||||
|
};
|
||||||
|
|
||||||
const [cardNumber, setCardNumber] = useState("");
|
const [cardNumber, setCardNumber] = useState("");
|
||||||
const [cardName, setCardName] = useState("");
|
const [cardName, setCardName] = useState("");
|
||||||
const [cardSecNumber, setCardSecNumber] = useState("");
|
const [cardSecNumber, setCardSecNumber] = useState("");
|
||||||
@@ -105,40 +112,49 @@ const SignupPage = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleStripePaymentAuthorization(paymentDataValues) {
|
||||||
|
console.log(paymentDataValues);
|
||||||
|
}
|
||||||
const handleSignup = async (e) => {
|
const handleSignup = async (e) => {
|
||||||
console.log("handleSignup");
|
|
||||||
/*
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (isBusy) {
|
const paymentDataValues = validatePaymentData();
|
||||||
|
if (paymentDataValues === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
const paymentSuccess = handleStripePaymentAuthorization(paymentDataValues);
|
||||||
|
|
||||||
setIsBusy(true);
|
if (paymentSuccess) {
|
||||||
try {
|
if (isBusy) {
|
||||||
const userCredential = await createUserWithEmailAndPassword(
|
return;
|
||||||
auth,
|
}
|
||||||
dataValues.email,
|
|
||||||
dataValues.password
|
setIsBusy(true);
|
||||||
);
|
try {
|
||||||
const user = userCredential.user;
|
const userCredential = await createUserWithEmailAndPassword(
|
||||||
await saveUserData(user.uid, dataValues);
|
auth,
|
||||||
navigate("/");
|
dataValues.email,
|
||||||
} catch (error) {
|
dataValues.password
|
||||||
setIsBusy(false);
|
);
|
||||||
setNotice(
|
const user = userCredential.user;
|
||||||
error.message || "Sorry, something went wrong. Please try again."
|
await saveUserData(user.uid, dataValues);
|
||||||
);
|
navigate("/");
|
||||||
|
} catch (error) {
|
||||||
|
setIsBusy(false);
|
||||||
|
setNotice(
|
||||||
|
error.message || "Sorry, something went wrong. Please try again."
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleProceed = () => {
|
const handleProceed = () => {
|
||||||
/*
|
|
||||||
const dataValues = validateData();
|
const dataValues = validateData();
|
||||||
if (dataValues === null) {
|
if (dataValues === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
setShowPaymentModal(true);
|
setShowPaymentModal(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user