From 7f86f1b3912ce2fd1d07085f89dea61888977c0b Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Mon, 14 Sep 2026 10:47:17 -0700 Subject: fetch worker id right from url, no RTK for now --- jb-ui/src/pages/Transfer.tsx | 12 ++++++++++-- 1 file 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("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) => { 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, }), }); -- cgit v1.2.3