From b1af1375578e41a240a4eedff73209e212a31051 Mon Sep 17 00:00:00 2001 From: stuppie Date: Tue, 22 Sep 2026 15:56:14 -0600 Subject: create_paypal_cashout_method upon user login. fix nginx for docs --- jb-ui/src/pages/CashoutConfirmation.tsx | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 jb-ui/src/pages/CashoutConfirmation.tsx (limited to 'jb-ui/src') diff --git a/jb-ui/src/pages/CashoutConfirmation.tsx b/jb-ui/src/pages/CashoutConfirmation.tsx new file mode 100644 index 0000000..6964672 --- /dev/null +++ b/jb-ui/src/pages/CashoutConfirmation.tsx @@ -0,0 +1,41 @@ +import { useEffect, useRef, useState } from "react"; + +type ConfirmationState = "working" | "confirmed" | "failed" | "missing"; + +const CashoutConfirmation = function () { + const started = useRef(false); + const [state, setState] = useState("working"); + + useEffect(() => { + if (started.current) return; + started.current = true; + + const params = new URLSearchParams(window.location.search); + const token = params.get("token"); + if (!token) { + setState("missing"); + return; + } + + window.history.replaceState({}, "", window.location.pathname); + + void fetch("/wallet/cashout/confirm/", { + method: "POST", + credentials: "include", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ token }), + }) + .then((response) => { + if (!response.ok) throw new Error("Cashout confirmation failed"); + setState("confirmed"); + }) + .catch(() => setState("failed")); + }, []); + + if (state === "missing") return

This cashout link is missing its token.

; + if (state === "failed") return

This cashout link is invalid or has expired.

; + if (state === "confirmed") return

Your cashout has been confirmed.

; + return

Confirming your cashout…

; +}; + +export default CashoutConfirmation; -- cgit v1.2.3