@@ -16,7 +16,8 @@ const AccountPage = () => {
|
|||||||
const [docsGenerated, setDocsGenerated] = useState(null);
|
const [docsGenerated, setDocsGenerated] = useState(null);
|
||||||
const appUserId = group ? group.appUserId : null;
|
const appUserId = group ? group.appUserId : null;
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
const subscriptionPlan = group?.subscriptionPlan[0].label;
|
||||||
|
console.log("subscriptionPlan", subscriptionPlan);
|
||||||
const apiUrl =
|
const apiUrl =
|
||||||
process.env.NODE_ENV === "development"
|
process.env.NODE_ENV === "development"
|
||||||
? process.env.REACT_APP_API_DEV
|
? process.env.REACT_APP_API_DEV
|
||||||
@@ -191,7 +192,7 @@ const AccountPage = () => {
|
|||||||
<div className="account-section">Active Subscriptions</div>
|
<div className="account-section">Active Subscriptions</div>
|
||||||
<div className="account-card account-subscriptions">
|
<div className="account-card account-subscriptions">
|
||||||
<div className="account-subscriptions-title">
|
<div className="account-subscriptions-title">
|
||||||
{group.subscriptionPlan.toUpperCase()}
|
{`${subscriptionPlan?.toUpperCase()} PLAN`}
|
||||||
</div>
|
</div>
|
||||||
<div className="account-subscriptions-item">
|
<div className="account-subscriptions-item">
|
||||||
<div className="account-subscriptions-item-label"></div>
|
<div className="account-subscriptions-item-label"></div>
|
||||||
@@ -201,7 +202,7 @@ const AccountPage = () => {
|
|||||||
<div className="account-subscriptions-item">
|
<div className="account-subscriptions-item">
|
||||||
<div className="account-subscriptions-item-label">Activated:</div>
|
<div className="account-subscriptions-item-label">Activated:</div>
|
||||||
<div className="account-subscriptions-item-value">
|
<div className="account-subscriptions-item-value">
|
||||||
{currentUserCreatedAt.toLocaleDateString("en-US")}
|
{currentUserCreatedAt?.toLocaleDateString("en-US")}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -217,13 +218,13 @@ const AccountPage = () => {
|
|||||||
<div className="account-column">
|
<div className="account-column">
|
||||||
<div className="account-card account-card-right-account account-info">
|
<div className="account-card account-card-right-account account-info">
|
||||||
<div className="account-info-name">
|
<div className="account-info-name">
|
||||||
{group.firstName} {group.lastName}
|
{group?.firstName} {group?.lastName}
|
||||||
</div>
|
</div>
|
||||||
<div>{group.firm}</div>
|
<div>{group?.firm}</div>
|
||||||
<div>
|
<div>
|
||||||
<a href={`mailto:${group.email}`}>{group.email}</a>
|
<a href={`mailto:${group?.email}`}>{group?.email}</a>
|
||||||
</div>
|
</div>
|
||||||
<div>{group.telephone}</div>
|
<div>{group?.telephone}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{showModal ? (
|
{showModal ? (
|
||||||
|
|||||||
@@ -382,28 +382,28 @@ const SignupPage = () => {
|
|||||||
dataValues
|
dataValues
|
||||||
);
|
);
|
||||||
|
|
||||||
const customerId = data.data.customerId;
|
const customerId = data?.data?.customerId;
|
||||||
const subscriptionCreated = data.data.subscriptionCreated;
|
const subscriptionCreated = data?.data?.subscriptionCreated;
|
||||||
const subscriptionPeriodStart = data.data.subscriptionPeriodStart;
|
const subscriptionPeriodStart = data?.data?.subscriptionPeriodStart;
|
||||||
const subscriptionPeriodEnd = data.data.subscriptionPeriodEnd;
|
const subscriptionPeriodEnd = data?.data?.subscriptionPeriodEnd;
|
||||||
const subscriptionId = data.data.subscriptionId;
|
const subscriptionId = data?.data?.subscriptionId;
|
||||||
|
|
||||||
if (data === undefined) {
|
if (data === undefined || customerId === undefined) {
|
||||||
setIsBusy(false);
|
setIsBusy(false);
|
||||||
setNotice("Sorry, something went wrong. Please try again.");
|
setNotice("Sorry, something went wrong. Please try again.");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
const userCredential = await createUserWithEmailAndPassword(
|
const userCredential = await createUserWithEmailAndPassword(
|
||||||
auth,
|
auth,
|
||||||
dataValues.email,
|
dataValues?.email,
|
||||||
dataValues.password
|
dataValues?.password
|
||||||
);
|
);
|
||||||
|
|
||||||
const user = userCredential.user;
|
const user = userCredential?.user;
|
||||||
dataValues = { ...dataValues, ...data };
|
dataValues = { ...dataValues, ...data };
|
||||||
const isPromotionalMebership = false;
|
const isPromotionalMebership = false;
|
||||||
const res = await saveUserData(
|
const res = await saveUserData(
|
||||||
user.uid,
|
user?.uid,
|
||||||
dataValues,
|
dataValues,
|
||||||
customerId,
|
customerId,
|
||||||
subscriptionCreated,
|
subscriptionCreated,
|
||||||
@@ -419,7 +419,6 @@ const SignupPage = () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error handling request", error, error.message);
|
console.log("Error handling request", error, error.message);
|
||||||
setIsBusy(false);
|
setIsBusy(false);
|
||||||
|
|
||||||
setNotice("Sorry, something went wrong. Please try again.");
|
setNotice("Sorry, something went wrong. Please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user