Merge pull request #63 from kjannette/apiCallCleanup

more
This commit is contained in:
S Jannette
2024-01-30 17:09:17 -06:00
committed by GitHub
4 changed files with 21 additions and 23 deletions

View File

@@ -121,8 +121,7 @@ const HomePage = () => {
AI-Powered Legal Drafting Technology{" "}
</h2>
<p className="section-three-subhead">
Created by litigators with law-centric AI at its core to give you
an edge.
Created by litigators to give you an edge.
</p>
</div>
<div className="card-section-container">

View File

@@ -41,7 +41,7 @@ const SignupPage = () => {
const [showSelectPlan, setShowSelectPlan] = useState(false);
const [activeRadioOption, setActiveRadioOption] = useState("partner");
const [selectedPlan, setSelectedPlan] = useState([signupRadioFields[1]]);
const [isAnnual, setIsAnnual] = useState(true);
const [isAnnual, setIsAnnual] = useState(1);
const stripe = new Stripe(stripeApiKey);
const apiUrl =
process.env.NODE_ENV === "development"
@@ -213,19 +213,23 @@ const SignupPage = () => {
if (isBusy) {
return;
}
/*
const dataValues = validateUserData();
if (dataValues === null) {
return;
}
saveLeadData(dataValues);
*/
setShowSelectPlan(!showSelectPlan);
};
const handleToggle = () => {
setIsAnnual(!isAnnual);
const handleToggle = (e) => {
if (isAnnual === e) {
return;
} else {
setIsAnnual(e);
}
};
const handleAddAccounts = () => {
@@ -236,7 +240,7 @@ const SignupPage = () => {
setShowAddAccount(!showAddAccount);
};
// ******************** STRIPE PAY API CALL ******************** //
// ******************** STRIPE PAYMENT API CALL ******************** //
async function handleStripeAuthorization(
paymentDataValues,
customerDataValues
@@ -262,6 +266,7 @@ const SignupPage = () => {
});
const type = selectedPlan[0].value ? selectedPlan[0].value : null;
const tempAnnual = isAnnual === 1 ? true : false;
try {
const response = await fetch(`${apiUrl}/create-subscription`, {
method: "POST",
@@ -271,7 +276,7 @@ const SignupPage = () => {
body: JSON.stringify({
planType: type,
additionalAccounts: additionalAccounts,
isAnnual: isAnnual,
isAnnual: tempAnnual,
customerData: {
email: customerDataValues.email,
name: `${customerDataValues.firstName} ${customerDataValues.lastName}`,
@@ -291,18 +296,10 @@ const SignupPage = () => {
};
} catch (error) {
console.log(error);
error = true;
return error;
}
if (error) {
return false;
}
return {
subscriptionId,
customerId,
};
}
// ******************** END STRIPE PAY API CALL ******************** //
// ******************** END STRIPE PAYMENT API CALL ******************** //
const handleSignup = async (e) => {
e.preventDefault();
@@ -598,7 +595,7 @@ const SignupPage = () => {
notice={notice}
setNotice={setNotice}
selectedPlan={selectedPlan}
isAnnual={isAnnual}
isAnnual={isAnnual === 1 ? true : false}
numberOfAccountsToAdd={numberOfAccountsToAdd}
fieldsChunkSize={2}
/>

View File

@@ -14,9 +14,10 @@ const Radio = (props) => {
details,
isAnnual,
} = props;
console.log("isAnnual in radio", isAnnual);
const classCheckbox = "checkbox";
const classOption = "option";
const index = isAnnual ? Number("1") : Number("0");
const index = isAnnual === 1 ? Number("1") : Number("0");
return (
<div className="radio-container">

View File

@@ -7,12 +7,13 @@ const Toggle = (props) => {
<>
<ToggleButtonGroup type="radio" name="options" defaultValue={1}>
<ToggleButton
onClick={onClick}
onClick={(e) => onClick(1)}
id="tbg-radio-1"
value={1}
></ToggleButton>
<ToggleButton
onClick={onClick}
onClick={(e) => onClick(2)}
id="tbg-radio-2"
value={2}
></ToggleButton>