From 0d2d862d4486487e6524f8796a407ab9ffc685b2 Mon Sep 17 00:00:00 2001 From: Umbrix Dev Date: Mon, 9 Feb 2026 04:56:14 +0300 Subject: [PATCH] fix: auto-refresh subscription after creation + back button already exists --- app/page.tsx | 9 +++++++++ app/plans/page.tsx | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 10ba9f5..a6d73c5 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -74,6 +74,15 @@ export default function Home() { return; } + // Проверяем параметр refresh в URL + const urlParams = new URLSearchParams(window.location.search); + const shouldRefresh = urlParams.get('refresh') === 'true'; + if (shouldRefresh) { + console.log('🔄 Refresh requested - clearing URL param'); + // Убираем параметр из URL без перезагрузки страницы + window.history.replaceState({}, '', window.location.pathname); + } + try { // Запрашиваем подписку по Telegram ID через API const params = new URLSearchParams(); diff --git a/app/plans/page.tsx b/app/plans/page.tsx index f5c3aa1..536d3af 100644 --- a/app/plans/page.tsx +++ b/app/plans/page.tsx @@ -180,8 +180,8 @@ export default function PlansNew() { const data = await response.json(); if (data.success) { - // Успех - возвращаемся на главную - router.push('/'); + // Успех - возвращаемся на главную с параметром обновления + router.push('/?refresh=true'); } else { throw new Error(data.error || 'Failed to create subscription'); }