diff options
| author | stuppie | 2026-09-22 15:56:14 -0600 |
|---|---|---|
| committer | stuppie | 2026-09-22 15:56:14 -0600 |
| commit | b1af1375578e41a240a4eedff73209e212a31051 (patch) | |
| tree | f665fe772a981b5c69b00da0587894ed9ada85a9 /jb-ui/src | |
| parent | b63021c4492a1742b8fa65c39ec648f140e0748b (diff) | |
| download | amt-jb-b1af1375578e41a240a4eedff73209e212a31051.tar.gz amt-jb-b1af1375578e41a240a4eedff73209e212a31051.zip | |
create_paypal_cashout_method upon user login. fix nginx for docs
Diffstat (limited to 'jb-ui/src')
| -rw-r--r-- | jb-ui/src/pages/CashoutConfirmation.tsx | 41 |
1 files changed, 41 insertions, 0 deletions
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<ConfirmationState>("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 <p>This cashout link is missing its token.</p>; + if (state === "failed") return <p>This cashout link is invalid or has expired.</p>; + if (state === "confirmed") return <p>Your cashout has been confirmed.</p>; + return <p>Confirming your cashout…</p>; +}; + +export default CashoutConfirmation; |
