diff --git a/src/pages/checkout/Checkout.tsx b/src/pages/checkout/Checkout.tsx
index 4839d79a..8997c27c 100644
--- a/src/pages/checkout/Checkout.tsx
+++ b/src/pages/checkout/Checkout.tsx
@@ -1,59 +1,13 @@
-/* eslint-disable jsx-a11y/anchor-is-valid */
-import React, { useEffect } from "react";
+import React from "react";
import Button from "react-bootstrap/Button";
-import { logevent } from "../../firebase/firebaseapp";
-import { Alert } from "react-bootstrap";
import FormComponent from "./FormComponent";
-import { useSelector, useDispatch } from 'react-redux';
-import { RootState } from './store';
-import { setPaymentId, setPaid } from "./formSlice";
function Checkout() {
- const dev = window.location.hostname === "localhost";
-
- const { paid, showMustpay } = useSelector((state: RootState) => state.form);
- const dispatch = useDispatch();
-
- useEffect(() => {
- const urlParams = new URLSearchParams(window.location.search);
- const id = urlParams.get("id");
- if (id) {
- dispatch(setPaid(true));
- dispatch(setPaymentId(id));
- }
-
- logevent("view", { name: window.location.pathname });
- }, [dispatch]);
return (
<>
Need help? Contact us at support@engresume.com
diff --git a/src/pages/checkout/FormComponent.tsx b/src/pages/checkout/FormComponent.tsx index ea899adc..5ccfd7f9 100644 --- a/src/pages/checkout/FormComponent.tsx +++ b/src/pages/checkout/FormComponent.tsx @@ -3,15 +3,21 @@ import Form from "react-bootstrap/Form"; import Button from "react-bootstrap/Button"; import { useSelector, useDispatch } from "react-redux"; import { RootState } from "./store"; -import { setShowMustpay, setEmail, setResume, setNotes } from "./formSlice"; +import { setEmail, setResume, setNotes } from "./formSlice"; const FormComponent: React.FC = () => { const [triedSubmit, setTriedSubmit] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); - const { email, resume, notes, paid, paymentId, showMustpay } = useSelector( + const { email, resume, notes } = useSelector( (state: RootState) => state.form ); + + const stripeLink = + window.location.hostname === "localhost" + ? "https://buy.stripe.com/test_dR62bE7Py3ks75e7ss" + : "https://buy.stripe.com/28og1KgbZ3ZG7aE9AA"; + const dispatch = useDispatch(); const handleSubmit = (e: React.FormEvent) => { @@ -22,11 +28,6 @@ const FormComponent: React.FC = () => { return; } - if (!paid) { - dispatch(setShowMustpay(true)); - return; - } - const fileInput = document.getElementById( "formBasicResume" ) as HTMLInputElement; @@ -54,7 +55,6 @@ const FormComponent: React.FC = () => { formData.append("resume", resumeFile); formData.append("email", email); formData.append("notes", notes); - formData.append("paymentId", paymentId); setIsSubmitting(true); @@ -63,8 +63,8 @@ const FormComponent: React.FC = () => { body: formData, }) .then((res) => { - // Redirect the user to /success page - window.location.href = "/success"; + // Redirect the user to Stripe Checkout + window.location.href = stripeLink; }) .catch((err) => { alert( @@ -132,14 +132,8 @@ const FormComponent: React.FC = () => { - - {showMustpay && ( -