diff --git a/src/Components/Account/AccountPage.js b/src/Components/Account/AccountPage.js index 55a5e0c..da4341e 100644 --- a/src/Components/Account/AccountPage.js +++ b/src/Components/Account/AccountPage.js @@ -16,7 +16,8 @@ const AccountPage = () => { const [docsGenerated, setDocsGenerated] = useState(null); const appUserId = group ? group.appUserId : null; const [showModal, setShowModal] = useState(false); - + const subscriptionPlan = group?.subscriptionPlan[0].label; + console.log("subscriptionPlan", subscriptionPlan); const apiUrl = process.env.NODE_ENV === "development" ? process.env.REACT_APP_API_DEV @@ -191,7 +192,7 @@ const AccountPage = () => {
Active Subscriptions
- {group.subscriptionPlan.toUpperCase()} + {`${subscriptionPlan?.toUpperCase()} PLAN`}
@@ -201,7 +202,7 @@ const AccountPage = () => {
Activated:
- {currentUserCreatedAt.toLocaleDateString("en-US")} + {currentUserCreatedAt?.toLocaleDateString("en-US")}
) : null} @@ -217,13 +218,13 @@ const AccountPage = () => {
- {group.firstName} {group.lastName} + {group?.firstName} {group?.lastName}
-
{group.firm}
+
{group?.firm}
- {group.email} + {group?.email}
-
{group.telephone}
+
{group?.telephone}
{showModal ? ( diff --git a/src/Components/SignupPage/SignupPage.js b/src/Components/SignupPage/SignupPage.js index af873a5..bdcf3ab 100644 --- a/src/Components/SignupPage/SignupPage.js +++ b/src/Components/SignupPage/SignupPage.js @@ -382,28 +382,28 @@ const SignupPage = () => { dataValues ); - const customerId = data.data.customerId; - const subscriptionCreated = data.data.subscriptionCreated; - const subscriptionPeriodStart = data.data.subscriptionPeriodStart; - const subscriptionPeriodEnd = data.data.subscriptionPeriodEnd; - const subscriptionId = data.data.subscriptionId; + const customerId = data?.data?.customerId; + const subscriptionCreated = data?.data?.subscriptionCreated; + const subscriptionPeriodStart = data?.data?.subscriptionPeriodStart; + const subscriptionPeriodEnd = data?.data?.subscriptionPeriodEnd; + const subscriptionId = data?.data?.subscriptionId; - if (data === undefined) { + if (data === undefined || customerId === undefined) { setIsBusy(false); setNotice("Sorry, something went wrong. Please try again."); return; } else { const userCredential = await createUserWithEmailAndPassword( auth, - dataValues.email, - dataValues.password + dataValues?.email, + dataValues?.password ); - const user = userCredential.user; + const user = userCredential?.user; dataValues = { ...dataValues, ...data }; const isPromotionalMebership = false; const res = await saveUserData( - user.uid, + user?.uid, dataValues, customerId, subscriptionCreated, @@ -419,7 +419,6 @@ const SignupPage = () => { } catch (error) { console.log("Error handling request", error, error.message); setIsBusy(false); - setNotice("Sorry, something went wrong. Please try again."); } }