mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
fix: batch bug fixes matching backend changes
- Promo code errors: add inactive/not_yet_valid translations (4 locales) + Balance.tsx parser - Daily 100% discount: render price block when originalDailyPrice > 0 - Webvisor: enable in Yandex Metrika init config - Referral attribution: consume campaign/referral slugs only after successful auth (all login methods) - registerWithEmail: consume referral code after success - AdminSettings: move TARIFF_MODE_SETTINGS to module scope (fix eslint warning)
This commit is contained in:
@@ -177,15 +177,20 @@ export default function Balance() {
|
||||
} catch (error: unknown) {
|
||||
const axiosError = error as { response?: { data?: { detail?: string } } };
|
||||
const errorDetail = axiosError.response?.data?.detail || 'server_error';
|
||||
const errorKey = errorDetail.toLowerCase().includes('not found')
|
||||
const detail = errorDetail.toLowerCase();
|
||||
const errorKey = detail.includes('not found')
|
||||
? 'not_found'
|
||||
: errorDetail.toLowerCase().includes('expired')
|
||||
? 'expired'
|
||||
: errorDetail.toLowerCase().includes('fully used')
|
||||
? 'used'
|
||||
: errorDetail.toLowerCase().includes('already used')
|
||||
? 'already_used_by_user'
|
||||
: 'server_error';
|
||||
: detail.includes('deactivated')
|
||||
? 'inactive'
|
||||
: detail.includes('not yet active')
|
||||
? 'not_yet_valid'
|
||||
: detail.includes('expired')
|
||||
? 'expired'
|
||||
: detail.includes('fully used')
|
||||
? 'used'
|
||||
: detail.includes('already used')
|
||||
? 'already_used_by_user'
|
||||
: 'server_error';
|
||||
setPromocodeError(t(`balance.promocode.errors.${errorKey}`));
|
||||
setPromoSelectSubs(null);
|
||||
setPromoSelectCode(null);
|
||||
|
||||
Reference in New Issue
Block a user