fix: auto-refresh subscription after creation + back button already exists
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user