Skip to content

Commit

Permalink
refactor: cleaned code
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushKapoorJuspay committed Jun 30, 2024
1 parent 5dbe15d commit 3a4f1c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 44 deletions.
28 changes: 11 additions & 17 deletions Hyperswitch-React-Demo-App/src/Payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import { useEffect, useState } from "react";
import React from "react";
import { HyperElements } from "@juspay-tech/react-hyper-js";
import CheckoutForm from "./CheckoutForm";
import { loadSDK } from "./something";

function Payment() {
const [hyperPromise, setHyperPromise] = useState(null);
const [clientSecret, setClientSecret] = useState("");
const [pubKey, setPublishable] = useState("");

useEffect(() => {
const fetchData = async () => {
Expand Down Expand Up @@ -74,27 +72,23 @@ function Payment() {
fetchData();
}, []);

useEffect(() => {
clientSecret && pubKey && loadSDK(clientSecret, pubKey);
}, [pubKey, clientSecret]);

return (
<div className="mainContainer">
<div className="heading">
<h2>Hyperswitch Unified Checkout</h2>
</div>
{clientSecret && hyperPromise && (
// <HyperElements
// hyper={hyperPromise}
// options={{
// clientSecret,
// appearance: {
// labels: "floating",
// },
// }}
// >
<CheckoutForm />
// </HyperElements>
<HyperElements
hyper={hyperPromise}
options={{
clientSecret,
appearance: {
labels: "floating",
},
}}
>
<CheckoutForm />
</HyperElements>
)}
</div>
);
Expand Down
27 changes: 0 additions & 27 deletions Hyperswitch-React-Demo-App/src/something.js

This file was deleted.

0 comments on commit 3a4f1c5

Please sign in to comment.