diff options
| author | Max Nanis | 2026-09-14 10:47:17 -0700 |
|---|---|---|
| committer | Max Nanis | 2026-09-14 10:47:17 -0700 |
| commit | 7f86f1b3912ce2fd1d07085f89dea61888977c0b (patch) | |
| tree | 2238e63e9c9588e73fc03906ffb1bdd8f9cf7b04 | |
| parent | bd3f6f908410ef4ab55dab3dc4c99433f033e924 (diff) | |
| download | amt-jb-7f86f1b3912ce2fd1d07085f89dea61888977c0b.tar.gz amt-jb-7f86f1b3912ce2fd1d07085f89dea61888977c0b.zip | |
fetch worker id right from url, no RTK for now
| -rw-r--r-- | jb-ui/src/pages/Transfer.tsx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/jb-ui/src/pages/Transfer.tsx b/jb-ui/src/pages/Transfer.tsx index c32fbca..c069a45 100644 --- a/jb-ui/src/pages/Transfer.tsx +++ b/jb-ui/src/pages/Transfer.tsx @@ -1,4 +1,5 @@ import { type FormEvent, useState } from "react"; +import { useSearchParams } from "react-router-dom"; import { useAppSelector } from "@/hooks"; import { Button } from "@/components/ui/button"; import max_lulu from "./max-and-lulu.jpg"; @@ -47,12 +48,19 @@ interface TransferSubmitProps { const TransferSubmit = function ({ onSubmitSuccess }: TransferSubmitProps) { const [email, setEmail] = useState(""); const [state, setState] = useState<RequestState>("idle"); - const bpuid = useAppSelector((state) => state.app.bpuid); + // const bpuid = useAppSelector((state) => state.app.bpuid); + + const [searchParams] = useSearchParams(); + + const workerId = searchParams.get("workerId"); const submit = async (event: FormEvent<HTMLFormElement>) => { event.preventDefault(); setState("working"); + if (!workerId) + throw new Error("Account-link request failed without workerId"); + try { const response = await fetch("/auth/link-amt/request/", { method: "POST", @@ -60,7 +68,7 @@ const TransferSubmit = function ({ onSubmitSuccess }: TransferSubmitProps) { headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email: email, - amt_worker_id: bpuid, + amt_worker_id: workerId, }), }); |
