more
This commit is contained in:
@@ -73,7 +73,7 @@ const SignupPage = () => {
|
||||
|
||||
const handleConfirmPromoCode = () => {
|
||||
if (issueText === marchEmailPrm) {
|
||||
console.log("we got a winner");
|
||||
handlePromoSignup();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -409,6 +409,57 @@ const SignupPage = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handlePromoSignup = async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
let dataValues = validateUserData();
|
||||
if (dataValues === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
//const planType = determinePlan(isAnnual, activeRadioOption);
|
||||
|
||||
if (dataValues) {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
setIsBusy(true);
|
||||
|
||||
try {
|
||||
//const customerId = data.data.customerId;
|
||||
|
||||
const subscriptionCreated = new Date();
|
||||
const subscriptionPeriodStart = subscriptionCreated;
|
||||
//const subscriptionPeriodEnd = 30 days from date created
|
||||
const subscriptionId = uuidv4();
|
||||
const isPromotionalMebership = true;
|
||||
|
||||
const userCredential = await createUserWithEmailAndPassword(
|
||||
auth,
|
||||
dataValues.email,
|
||||
dataValues.password
|
||||
);
|
||||
|
||||
const user = userCredential.user;
|
||||
dataValues = { ...dataValues, ...data };
|
||||
const res = await saveUserData(
|
||||
user.uid,
|
||||
dataValues,
|
||||
|
||||
subscriptionCreated,
|
||||
subscriptionPeriodStart,
|
||||
subscriptionPeriodEnd,
|
||||
subscriptionId
|
||||
);
|
||||
console.log("res", res);
|
||||
setIsBusy(false);
|
||||
navigate("/dashboard");
|
||||
} catch (error) {
|
||||
console.log("Error handling request", error, error.message);
|
||||
setIsBusy(false);
|
||||
setNotice("Sorry, something went wrong. Please try again.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const showNoticeOnPage = "" !== notice && !showPaymentModal;
|
||||
const addAccountCopy =
|
||||
selectedPlan[0]?.value === "seniorPartner"
|
||||
|
||||
Reference in New Issue
Block a user