This commit is contained in:
Kenneth Jannette
2024-02-15 21:21:16 -06:00
parent 4a23953d7b
commit d955128bbf

View File

@@ -73,7 +73,7 @@ const SignupPage = () => {
const handleConfirmPromoCode = () => { const handleConfirmPromoCode = () => {
if (issueText === marchEmailPrm) { 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 showNoticeOnPage = "" !== notice && !showPaymentModal;
const addAccountCopy = const addAccountCopy =
selectedPlan[0]?.value === "seniorPartner" selectedPlan[0]?.value === "seniorPartner"