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
This commit is contained in:
2026-06-05 21:15:05 +01:00
parent d2dea38b01
commit 44c9d423ec
+3 -1
View File
@@ -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;