Merge pull request #60 from kjannette/tree

Tree
This commit is contained in:
S Jannette
2024-01-29 21:23:01 -06:00
committed by GitHub
4 changed files with 18 additions and 39 deletions

View File

@@ -26,6 +26,7 @@ const Login = () => {
email, email,
password password
); );
// Signed in // Signed in
userCredential?.user && navigate("/dashboard"); userCredential?.user && navigate("/dashboard");
} catch (error) { } catch (error) {

View File

@@ -53,10 +53,6 @@ const PaymentModal = ({
const totalToday = amountToday + extraAccountsPrice; const totalToday = amountToday + extraAccountsPrice;
function handleValidateAndPay() {
handleSignup(totalToday);
}
return ( return (
<Modal show="true" size="lg"> <Modal show="true" size="lg">
<Modal.Header className="payment-modal-header" closeButton> <Modal.Header className="payment-modal-header" closeButton>
@@ -151,7 +147,7 @@ const PaymentModal = ({
<Button <Button
disabled={isBusy} disabled={isBusy}
className="primary-button" className="primary-button"
onClick={handleValidateAndPay} onClick={handleSignup}
labelText="Signup" labelText="Signup"
/> />
</Modal.Footer> </Modal.Footer>

View File

@@ -3,7 +3,9 @@ import { AuthContext } from "../Context/AuthProvider";
import { Navigate } from "react-router-dom"; import { Navigate } from "react-router-dom";
const PrivateRoute = ({ children }) => { const PrivateRoute = ({ children }) => {
console.log("AuthContext", AuthContext);
const { currentUserEmail } = useContext(AuthContext); const { currentUserEmail } = useContext(AuthContext);
console.log("currentUserEmail", currentUserEmail);
return currentUserEmail === null ? <Navigate to="/" /> : children; return currentUserEmail === null ? <Navigate to="/" /> : children;
}; };

View File

@@ -188,8 +188,8 @@ const SignupPage = () => {
barNumber, barNumber,
practiceArea, practiceArea,
email, email,
subscriptionId, //subscriptionId,
customerId, //customerId,
}; };
try { try {
@@ -216,14 +216,14 @@ const SignupPage = () => {
if (isBusy) { if (isBusy) {
return; return;
} }
/*
const dataValues = validateUserData(); const dataValues = validateUserData();
if (dataValues === null) { if (dataValues === null) {
return; return;
} }
saveLeadData(dataValues); saveLeadData(dataValues);
*/
setShowSelectPlan(!showSelectPlan); setShowSelectPlan(!showSelectPlan);
}; };
@@ -245,7 +245,6 @@ const SignupPage = () => {
paymentDataValues, paymentDataValues,
customerDataValues customerDataValues
) { ) {
console.log("======>numberOfAccountsToAdd", numberOfAccountsToAdd);
const additionalAccounts = numberOfAccountsToAdd const additionalAccounts = numberOfAccountsToAdd
? numberOfAccountsToAdd ? numberOfAccountsToAdd
: 0; : 0;
@@ -292,7 +291,7 @@ const SignupPage = () => {
return { return {
subscriptionId, subscriptionId,
customerId, //customerId,
}; };
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@@ -309,45 +308,23 @@ const SignupPage = () => {
} }
// ******************** END STRIPE PAY API CALL ******************** // // ******************** END STRIPE PAY API CALL ******************** //
const handleSignup = async (totalDue) => { const handleSignup = async (e) => {
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>handleSignup fired"); e.preventDefault();
console.log("handleSignup");
const paymentDataValues = validatePaymentData(); const paymentDataValues = validatePaymentData();
if (paymentDataValues === null) { if (paymentDataValues === null) {
return; return;
} }
/* let dataValues = validateUserData(); let dataValues = validateUserData();
if (dataValues === null) { if (dataValues === null) {
return; return;
} }
*/
const id = uuidv4();
const email = `${id}@jim.com`;
let dataValues = {
firstName: "fffff",
lastName: "ffff",
firm: "form",
telephone: "(313) 333-3333",
streetAddress: "123 main",
city: "new york",
state: "New York",
zipCode: "10122",
barNumber: "2343434",
practiceArea: "3df",
email: email,
password: "stingPrug1",
confirmPassword: "stingPrug1",
};
const planType = determinePlan(isAnnual, activeRadioOption); //const planType = determinePlan(isAnnual, activeRadioOption);
console.log(planType);
setIsBusy(true); setIsBusy(true);
if (paymentDataValues && dataValues) { if (paymentDataValues && dataValues) {
console.log(
"tryblock ~~~ tryblock ~~~ tryblock ~~~ tryblock ~~~ tryblock ~~~ "
);
try { try {
const userCredential = await createUserWithEmailAndPassword( const userCredential = await createUserWithEmailAndPassword(
auth, auth,
@@ -362,7 +339,10 @@ const SignupPage = () => {
paymentDataValues, paymentDataValues,
dataValues dataValues
); );
console.log(
"----------------------------->>>>>>>>>>>>>>>>>paymentResponse",
paymentResponse
);
if (paymentResponse === false) { if (paymentResponse === false) {
setIsBusy(false); setIsBusy(false);
setNotice("Sorry, something went wrong. Please try again."); setNotice("Sorry, something went wrong. Please try again.");