more
This commit is contained in:
@@ -146,7 +146,7 @@ const SignupPage = () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function saveUserData(authId, dataValues) {
|
||||
async function saveUserData(authId, dataValues, customerId, subscriptionId) {
|
||||
const appUserId = uuidv4();
|
||||
const firmId = uuidv4();
|
||||
const fbAuthUid = authId;
|
||||
@@ -167,10 +167,11 @@ const SignupPage = () => {
|
||||
practiceArea,
|
||||
email,
|
||||
} = dataValues;
|
||||
|
||||
const subscriptionId = dataValues?.subscriptionId;
|
||||
const customerId = dataValues?.customerId;
|
||||
|
||||
console.log(
|
||||
"customerId, subscriptionId in saveUserData",
|
||||
customerId,
|
||||
subscriptionId
|
||||
);
|
||||
const userData = {
|
||||
docsAllowed,
|
||||
docsGenerated,
|
||||
@@ -188,8 +189,8 @@ const SignupPage = () => {
|
||||
barNumber,
|
||||
practiceArea,
|
||||
email,
|
||||
//subscriptionId,
|
||||
//customerId,
|
||||
customerId: customerId,
|
||||
subscriptionId: subscriptionId,
|
||||
};
|
||||
|
||||
try {
|
||||
@@ -325,18 +326,15 @@ const SignupPage = () => {
|
||||
setIsBusy(true);
|
||||
if (paymentDataValues && dataValues) {
|
||||
try {
|
||||
const paymentResponse = await handleStripeAuthorization(
|
||||
const data = await handleStripeAuthorization(
|
||||
paymentDataValues,
|
||||
dataValues
|
||||
);
|
||||
console.log(
|
||||
"----------------------------->>>>>>>>>>>>>>>>>paymentResponse",
|
||||
paymentResponse
|
||||
);
|
||||
const customerId = data.customerId;
|
||||
const subscriptionId = data.subscriptionId;
|
||||
console.log("----------------------------->>>>>>>>>>>>>>>>>data", data);
|
||||
const customerId = data.data.customerId;
|
||||
const subscriptionId = data.data.subscriptionId;
|
||||
|
||||
if (paymentResponse === false) {
|
||||
if (data === undefined) {
|
||||
setIsBusy(false);
|
||||
setNotice("Sorry, something went wrong. Please try again.");
|
||||
return;
|
||||
@@ -348,14 +346,13 @@ const SignupPage = () => {
|
||||
);
|
||||
|
||||
const user = userCredential.user;
|
||||
dataValues = { ...dataValues, ...paymentResponse };
|
||||
if (subscriptionId) {
|
||||
dataValues.subscriptionId = subscriptionId;
|
||||
}
|
||||
if (customerId) {
|
||||
dataValues.customerId = customerId;
|
||||
}
|
||||
await saveUserData(user.uid, dataValues);
|
||||
dataValues = { ...dataValues, ...data };
|
||||
console.log(
|
||||
"customerId, subscriptionId in handleSignup right before saveUserData",
|
||||
customerId,
|
||||
subscriptionId
|
||||
);
|
||||
await saveUserData(user.uid, dataValues, customerId, subscriptionId);
|
||||
navigate("/dashboard");
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user