Merge pull request #216 from BEDOLAGA-DEV/dev

Dev
This commit is contained in:
Egor
2026-02-12 03:06:39 +03:00
committed by GitHub
7 changed files with 20 additions and 5 deletions

View File

@@ -110,7 +110,9 @@ export const authApi = {
}, },
// Request email change - sends verification code to new email // Request email change - sends verification code to new email
requestEmailChange: async (newEmail: string): Promise<{ message: string }> => { requestEmailChange: async (
newEmail: string,
): Promise<{ message: string; new_email: string; expires_in_minutes: number }> => {
const response = await apiClient.post('/cabinet/auth/email/change', { const response = await apiClient.post('/cabinet/auth/email/change', {
new_email: newEmail, new_email: newEmail,
}); });

View File

@@ -454,6 +454,7 @@
"trafficUnavailable": "Traffic purchase is not available for your tariff", "trafficUnavailable": "Traffic purchase is not available for your tariff",
"unlimited": "Unlimited", "unlimited": "Unlimited",
"buyTrafficGb": "Buy {{gb}} GB", "buyTrafficGb": "Buy {{gb}} GB",
"buyUnlimited": "Buy Unlimited",
"manageServers": "Server management", "manageServers": "Server management",
"manageServersTitle": "Server management" "manageServersTitle": "Server management"
}, },

View File

@@ -328,6 +328,7 @@
"trafficUnavailable": "خرید ترافیک برای اشتراک شما در دسترس نیست", "trafficUnavailable": "خرید ترافیک برای اشتراک شما در دسترس نیست",
"unlimited": "نامحدود", "unlimited": "نامحدود",
"buyTrafficGb": "خرید {{gb}} GB", "buyTrafficGb": "خرید {{gb}} GB",
"buyUnlimited": "خرید نامحدود",
"manageServers": "مدیریت سرورها", "manageServers": "مدیریت سرورها",
"manageServersTitle": "مدیریت سرورها" "manageServersTitle": "مدیریت سرورها"
}, },

View File

@@ -481,6 +481,7 @@
"trafficUnavailable": "Докупка трафика недоступна для вашего тарифа", "trafficUnavailable": "Докупка трафика недоступна для вашего тарифа",
"unlimited": "Безлимит", "unlimited": "Безлимит",
"buyTrafficGb": "Купить {{gb}} ГБ", "buyTrafficGb": "Купить {{gb}} ГБ",
"buyUnlimited": "Купить Безлимит",
"manageServers": "Управление серверами", "manageServers": "Управление серверами",
"manageServersTitle": "Управление серверами" "manageServersTitle": "Управление серверами"
}, },

View File

@@ -328,6 +328,7 @@
"trafficUnavailable": "您的套餐不支持购买流量", "trafficUnavailable": "您的套餐不支持购买流量",
"unlimited": "无限制", "unlimited": "无限制",
"buyTrafficGb": "购买 {{gb}} GB", "buyTrafficGb": "购买 {{gb}} GB",
"buyUnlimited": "购买无限流量",
"manageServers": "服务器管理", "manageServers": "服务器管理",
"manageServersTitle": "服务器管理" "manageServersTitle": "服务器管理"
}, },

View File

@@ -181,10 +181,17 @@ export default function Profile() {
// Email change mutations // Email change mutations
const requestEmailChangeMutation = useMutation({ const requestEmailChangeMutation = useMutation({
mutationFn: (emailAddr: string) => authApi.requestEmailChange(emailAddr), mutationFn: (emailAddr: string) => authApi.requestEmailChange(emailAddr),
onSuccess: () => { onSuccess: async (data) => {
setChangeError(null); setChangeError(null);
setChangeEmailStep('code'); if (data.expires_in_minutes === 0) {
setResendCooldown(UI.RESEND_COOLDOWN_SEC); // Unverified email was replaced directly
setChangeEmailStep('success');
const updatedUser = await authApi.getMe();
setUser(updatedUser);
} else {
setChangeEmailStep('code');
setResendCooldown(UI.RESEND_COOLDOWN_SEC);
}
}, },
onError: (err: { response?: { data?: { detail?: string } } }) => { onError: (err: { response?: { data?: { detail?: string } } }) => {
const detail = err.response?.data?.detail; const detail = err.response?.data?.detail;

View File

@@ -1588,7 +1588,7 @@ export default function Subscription() {
))} ))}
</div> </div>
{selectedTrafficPackage && {selectedTrafficPackage !== null &&
(() => { (() => {
const selectedPkg = trafficPackages.find( const selectedPkg = trafficPackages.find(
(p) => p.gb === selectedTrafficPackage, (p) => p.gb === selectedTrafficPackage,
@@ -1625,6 +1625,8 @@ export default function Subscription() {
<span className="flex items-center justify-center gap-2"> <span className="flex items-center justify-center gap-2">
<span className="h-4 w-4 animate-spin rounded-full border-2 border-white/30 border-t-white" /> <span className="h-4 w-4 animate-spin rounded-full border-2 border-white/30 border-t-white" />
</span> </span>
) : selectedPkg?.is_unlimited ? (
t('subscription.additionalOptions.buyUnlimited')
) : ( ) : (
t('subscription.additionalOptions.buyTrafficGb', { t('subscription.additionalOptions.buyTrafficGb', {
gb: selectedTrafficPackage, gb: selectedTrafficPackage,