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:
@@ -477,6 +477,7 @@
|
|||||||
toast.error('Please fill in all card details correctly');
|
toast.error('Please fill in all card details correctly');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const cardNum = newCardNumber.replace(/\s/g, '');
|
||||||
const [monthStr, yearStr] = newCardExpiry.split('/');
|
const [monthStr, yearStr] = newCardExpiry.split('/');
|
||||||
const month = parseInt(monthStr, 10);
|
const month = parseInt(monthStr, 10);
|
||||||
const year = 2000 + parseInt(yearStr, 10);
|
const year = 2000 + parseInt(yearStr, 10);
|
||||||
@@ -514,7 +515,8 @@
|
|||||||
const errText = await res.text();
|
const errText = await res.text();
|
||||||
toast.error(errText || 'Failed to add card');
|
toast.error(errText || 'Failed to add card');
|
||||||
}
|
}
|
||||||
} catch {
|
} catch (err) {
|
||||||
|
console.error('addCard error:', err);
|
||||||
toast.error('Network error');
|
toast.error('Network error');
|
||||||
} finally {
|
} finally {
|
||||||
addingCard = false;
|
addingCard = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user