more
This commit is contained in:
@@ -34,13 +34,12 @@ const HomePage = () => {
|
||||
subscriptionPeriodEnd,
|
||||
subscriptionId,
|
||||
isPromotionalMebership,
|
||||
docsAllowedPeMonth
|
||||
docsAllowedPeMonth = 1
|
||||
) {
|
||||
if (!email || !password) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("email, password", email, password);
|
||||
const appUserId = uuidv4();
|
||||
const firmId = uuidv4();
|
||||
const fbAuthUid = authId;
|
||||
@@ -91,7 +90,7 @@ const HomePage = () => {
|
||||
isPromotionalMebership,
|
||||
customerId: customerId,
|
||||
subscriptionId: subscriptionId,
|
||||
//subscriptionPlan: plan,
|
||||
subscriptionPlan: "flordia-spring-promo-plan",
|
||||
subscriptionCreated: subscriptionCreated,
|
||||
subscriptionPeriodStart: subscriptionPeriodStart,
|
||||
subscriptionPeriodEnd: subscriptionPeriodEnd,
|
||||
@@ -107,11 +106,13 @@ const HomePage = () => {
|
||||
}
|
||||
|
||||
async function getFocusData(code) {
|
||||
console.log("code in getFocusData", code);
|
||||
try {
|
||||
const response = await fetch(`${apiUrl}/v1/get-focused-data/${code}`, {
|
||||
method: "GET",
|
||||
});
|
||||
const res = await response.json();
|
||||
console.log("res in getFocusData", res);
|
||||
return res;
|
||||
} catch (err) {
|
||||
console.log("Error in get rqst:", err);
|
||||
@@ -126,30 +127,29 @@ const HomePage = () => {
|
||||
return;
|
||||
}
|
||||
const userData = await getFocusData(code);
|
||||
if (!userData) {
|
||||
console.log("userData in returned from getFocusData", userData);
|
||||
const email = userData[0].email;
|
||||
const password = userData[0].password;
|
||||
if (email && password) {
|
||||
console.log("123 email, password", email, password);
|
||||
handlePromoSignup(userData, email, password);
|
||||
}
|
||||
}
|
||||
|
||||
async function handlePromoSignup(dataValues, email, password) {
|
||||
if (!email || !password) {
|
||||
return;
|
||||
} else {
|
||||
handlePromoSignup(userData);
|
||||
}
|
||||
}
|
||||
|
||||
const handlePromoSignup = async (dataValues) => {
|
||||
console.log("dataValues in handlePromoSignup", dataValues);
|
||||
|
||||
if (dataValues) {
|
||||
try {
|
||||
const customerId = `${uuidv4()}-florida-spring-promo`;
|
||||
const today = new Date();
|
||||
const email = dataValues.email;
|
||||
const password = dataValues.password;
|
||||
const subscriptionCreated = today;
|
||||
const subscriptionPeriodStart = today;
|
||||
console.log("subscriptionPeriodStart", subscriptionPeriodStart);
|
||||
const subscriptionPeriodEnd = today;
|
||||
const subscriptionId = uuidv4();
|
||||
if (!email || !password) {
|
||||
return;
|
||||
}
|
||||
|
||||
const userCredential = await createUserWithEmailAndPassword(
|
||||
auth,
|
||||
email,
|
||||
@@ -171,6 +171,7 @@ const HomePage = () => {
|
||||
subscriptionId,
|
||||
isPromotionalMebership
|
||||
);
|
||||
console.log("res from saveUserData in handlePromoSignup", res);
|
||||
setIsBusy(false);
|
||||
navigate("/dashboard");
|
||||
} catch (error) {
|
||||
@@ -179,7 +180,6 @@ const HomePage = () => {
|
||||
setNotice("Sorry, something went wrong. Please try again.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleTryItButton = () => {
|
||||
setShowPromoModal(true);
|
||||
@@ -468,7 +468,11 @@ const HomePage = () => {
|
||||
</div>
|
||||
);
|
||||
|
||||
return isBusy ? <LoadingSpinner /> : homeContent;
|
||||
return isBusy ? (
|
||||
<LoadingSpinner message={""} loaderType="MoonLoader" />
|
||||
) : (
|
||||
homeContent
|
||||
);
|
||||
};
|
||||
|
||||
export default HomePage;
|
||||
|
||||
Reference in New Issue
Block a user