Update index.html

This commit is contained in:
Egor
2026-01-11 04:54:13 +03:00
committed by GitHub
parent 9dacd3be24
commit daf8214c40

View File

@@ -20526,16 +20526,24 @@
throw new Error(preferredLanguage === 'en' ? 'Invalid tariff' : 'Неверный тариф');
}
const requestBody = { initData, tariffId };
console.log('Switch preview request:', JSON.stringify(requestBody, null, 2));
const response = await fetch('/miniapp/subscription/tariff/switch/preview', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ initData, tariffId })
body: JSON.stringify(requestBody)
});
if (!response.ok) {
const error = await response.json();
console.error('Switch preview error:', error);
throw new Error(error?.detail?.message || error?.message || 'Ошибка');
// Показываем детали ошибки валидации
let errorMsg = error?.detail?.message || error?.message || 'Ошибка';
if (Array.isArray(error?.detail)) {
errorMsg = error.detail.map(e => e.msg || e.message).join('; ');
}
throw new Error(errorMsg);
}
instantSwitchPreviewData = await response.json();