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,
password
);
// Signed in
userCredential?.user && navigate("/dashboard");
} catch (error) {

View File

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

View File

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

View File

@@ -188,8 +188,8 @@ const SignupPage = () => {
barNumber,
practiceArea,
email,
subscriptionId,
customerId,
//subscriptionId,
//customerId,
};
try {
@@ -216,14 +216,14 @@ const SignupPage = () => {
if (isBusy) {
return;
}
/*
const dataValues = validateUserData();
if (dataValues === null) {
return;
}
saveLeadData(dataValues);
*/
setShowSelectPlan(!showSelectPlan);
};
@@ -245,7 +245,6 @@ const SignupPage = () => {
paymentDataValues,
customerDataValues
) {
console.log("======>numberOfAccountsToAdd", numberOfAccountsToAdd);
const additionalAccounts = numberOfAccountsToAdd
? numberOfAccountsToAdd
: 0;
@@ -292,7 +291,7 @@ const SignupPage = () => {
return {
subscriptionId,
customerId,
//customerId,
};
} catch (error) {
console.log(error);
@@ -309,45 +308,23 @@ const SignupPage = () => {
}
// ******************** END STRIPE PAY API CALL ******************** //
const handleSignup = async (totalDue) => {
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>handleSignup fired");
const handleSignup = async (e) => {
e.preventDefault();
console.log("handleSignup");
const paymentDataValues = validatePaymentData();
if (paymentDataValues === null) {
return;
}
/* let dataValues = validateUserData();
let dataValues = validateUserData();
if (dataValues === null) {
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);
console.log(planType);
//const planType = determinePlan(isAnnual, activeRadioOption);
setIsBusy(true);
if (paymentDataValues && dataValues) {
console.log(
"tryblock ~~~ tryblock ~~~ tryblock ~~~ tryblock ~~~ tryblock ~~~ "
);
try {
const userCredential = await createUserWithEmailAndPassword(
auth,
@@ -362,7 +339,10 @@ const SignupPage = () => {
paymentDataValues,
dataValues
);
console.log(
"----------------------------->>>>>>>>>>>>>>>>>paymentResponse",
paymentResponse
);
if (paymentResponse === false) {
setIsBusy(false);
setNotice("Sorry, something went wrong. Please try again.");