Query purchase fulfillment with identifier

main
MiguelMLorente 2025-12-07 14:14:16 +01:00
parent c15012afa7
commit 9607c3f83f
3 changed files with 7 additions and 4 deletions

View File

@ -42,8 +42,8 @@ export const startBuyFlow = (quantity: number) =>
AxiosResponse<{ url: string }, unknown, {}>
>;
export const completeBuyFlow = () =>
axios.post("/buy/complete", {}, getJwtHeader()) as Promise<
export const completeBuyFlow = (purchaseId: string) =>
axios.post("/buy/complete", { purchaseId }, getJwtHeader()) as Promise<
AxiosResponse<{ url: string }, unknown, {}>
>;

View File

@ -47,7 +47,7 @@ export const Buy = () => {
<FormControlLabel
value="10"
control={<Radio />}
label="10 tokens - 40"
label="10 tokens - 40"
/>
</RadioGroup>
</Paper>

View File

@ -2,7 +2,10 @@ import { completeBuyFlow } from "../../api/client";
import { CircularProgress, Grid, Typography } from "@mui/material";
export const BuyReturn = () => {
completeBuyFlow().then(
const purchaseId = new URL(window.location.href).searchParams.get(
"purchaseId",
)!;
completeBuyFlow(purchaseId).then(
(response) => (window.location.href = response.data.url),
);