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