Added Payment Failed text on shop purchase fail

This commit is contained in:
Tim Howitz 2025-06-06 18:25:35 +01:00
parent 127c69cb1e
commit 5024ad4324

View File

@ -295,7 +295,6 @@ export default function Shop() {
"#" + Math.random().toString(24).substring(2, 10).toUpperCase() + new Date().toLocaleDateString("en-GB"); "#" + Math.random().toString(24).substring(2, 10).toUpperCase() + new Date().toLocaleDateString("en-GB");
const orderNum = genOrder(); const orderNum = genOrder();
// todo add display of error
(async () => { (async () => {
try { try {
const response = await axios.post("/api/shop/purchase", { const response = await axios.post("/api/shop/purchase", {
@ -309,8 +308,8 @@ export default function Shop() {
setShowThankYouModal(true); setShowThankYouModal(true);
setCart((c) => c.filter((a) => !artefactsToBuy.map((x) => x.id).includes(a.id))); setCart((c) => c.filter((a) => !artefactsToBuy.map((x) => x.id).includes(a.id)));
} catch (error) { } catch (error) {
setError("Payment Failed");
console.error("Error posting artefacts:", error); console.error("Error posting artefacts:", error);
throw error;
} }
})(); })();
} }