fix(frontend): 改进订阅状态实时刷新机制

- 在 Dashboard 页面加载时强制刷新订阅状态
- 在兑换订阅卡密后立即刷新订阅状态
- 清理订阅轮询相关注释
This commit is contained in:
IanShaw027
2025-12-28 10:32:04 +08:00
parent 26cdb1805d
commit 4e3499c0d7
3 changed files with 16 additions and 2 deletions

View File

@@ -661,6 +661,7 @@ import { ref, computed, onMounted, watch } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { useAuthStore } from '@/stores/auth'
import { useSubscriptionStore } from '@/stores/subscriptions'
import { formatDateTime } from '@/utils/format'
const { t } = useI18n()
@@ -701,6 +702,7 @@ ChartJS.register(
const router = useRouter()
const authStore = useAuthStore()
const subscriptionStore = useSubscriptionStore()
const user = computed(() => authStore.user)
const stats = ref<UserDashboardStats | null>(null)
@@ -1018,6 +1020,11 @@ onMounted(async () => {
// Load critical data first
await loadDashboardStats()
// Force refresh subscription status when entering dashboard (bypass cache)
subscriptionStore.fetchActiveSubscriptions(true).catch((error) => {
console.error('Failed to refresh subscription status:', error)
})
// Initialize date range (synchronous)
initializeDateRange()