(undefined);
useEffect(() => {
const doFetch = async () => {
try {
const hc = await wxApi.applyRefund(props.talerRefundUri);
setApplied(true);
const r = await wxApi.getPurchaseDetails(hc);
setPurchaseDetails(r);
} catch (e) {
console.error(e);
setErrMsg(e.message);
console.log("err message", e.message);
}
};
doFetch();
}, []);
console.log("rendering");
if (errMsg) {
return Error: {errMsg};
}
if (!applied || !purchaseDetails) {
return Updating refund status;
}
return (
<>
Refund Status
The product {purchaseDetails.contractTerms.summary!} has
received a total refund of{" "}
.
Note that additional fees from the exchange may apply.
>
);
}
async function main() {
const url = new URL(document.location.href);
const container = document.getElementById("container");
if (!container) {
console.error("fatal: can't mount component, container missing");
return;
}
const talerRefundUri = url.searchParams.get("talerRefundUri");
if (!talerRefundUri) {
console.error("taler refund URI requred");
return;
}
ReactDOM.render(
,
container,
);
}
document.addEventListener("DOMContentLoaded", () => main());