From 44c9d423ecfb4a642bc7e9a8bf719724be4ae63c Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Fri, 5 Jun 2026 21:15:05 +0100 Subject: [PATCH] fix: restore cardNum definition in addCard - Re-added 'const cardNum = newCardNumber.replace(/\s/g, '');' inside addCard - Log actual error to console in catch block of addCard --- frontend/src/routes/account/+page.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/routes/account/+page.svelte b/frontend/src/routes/account/+page.svelte index 5d2d8fe..2e95a1d 100644 --- a/frontend/src/routes/account/+page.svelte +++ b/frontend/src/routes/account/+page.svelte @@ -477,6 +477,7 @@ toast.error('Please fill in all card details correctly'); return; } + const cardNum = newCardNumber.replace(/\s/g, ''); const [monthStr, yearStr] = newCardExpiry.split('/'); const month = parseInt(monthStr, 10); const year = 2000 + parseInt(yearStr, 10); @@ -514,7 +515,8 @@ const errText = await res.text(); toast.error(errText || 'Failed to add card'); } - } catch { + } catch (err) { + console.error('addCard error:', err); toast.error('Network error'); } finally { addingCard = false;