Skip to content

Commit

Permalink
Handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNeshi committed Dec 11, 2023
1 parent 7582bf9 commit 9c9aad7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/donation/Steps/DonateMethods/PayPal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ReactPayPalScriptOptions,
usePayPalScriptReducer,
} from "@paypal/react-paypal-js";
import { useErrorContext } from "contexts/ErrorContext";
import LoaderRing from "components/LoaderRing";
import { PAYPAL_CLIENT_ID } from "constants/env";

Expand All @@ -24,10 +25,12 @@ export default function PayPal() {

function ButtonWrapper() {
const [{ isPending }] = usePayPalScriptReducer();
const { handleError } = useErrorContext();

return (
<div className="grid place-items-center min-h-[16rem] isolate">
{isPending && <LoaderRing thickness={10} classes="w-8" />}
<PayPalButtons className="w-full max-w-xs" />
<PayPalButtons className="w-full max-w-xs" onError={handleError} />
</div>
);
}

0 comments on commit 9c9aad7

Please sign in to comment.