fix(auth,checkout): add Axios 401/403 auto-logout response interceptor and fix charity round-up 10k exact math

This commit is contained in:
parsa aghaei committed 2026-07-26 20:23:27 +03:30
1 parent 72badb1a7b
commit bdf8856883
3 files changed
+86 -8

No files matched your search

@@ -61,12 +61,12 @@ export default function CheckoutPage() {
}, [profile, isLoggedIn]);
const subtotal = getSubtotal();
const roundedAmount = Math.ceil(subtotal / 10000) * 10000;
const roundUpDiff = roundedAmount - subtotal;
const remainder = subtotal % 10000;
const roundUpDiff = remainder === 0 ? 10000 : 10000 - remainder;
const handleCharityToggle = () => {
if (!useRoundUp) {
setCharityDonation(Math.max(roundUpDiff, Math.round(subtotal * 0.01)));
setCharityDonation(roundUpDiff);
setUseRoundUp(true);
} else {
setCharityDonation(0);