From 4b1855f57a1ff819f1bb98f4ca8a798b1330b631 Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 15 Jan 2026 06:34:19 -0800 Subject: [PATCH] fix(mining-app): use public API for asset page to avoid JWT mismatch Changed from myAssetProvider (requires JWT) to accountAssetProvider (public API) to avoid 401 errors when trading-service JWT_SECRET doesn't match auth-service. Co-Authored-By: Claude Opus 4.5 --- .../lib/presentation/pages/asset/asset_page.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart b/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart index de04ece0..3f495d36 100644 --- a/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart +++ b/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart @@ -24,10 +24,12 @@ class AssetPage extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final user = ref.watch(userNotifierProvider); - final assetAsync = ref.watch(myAssetProvider); + final accountSequence = user.accountSequence ?? ''; + // 使用 public API,不依赖 JWT token + final assetAsync = ref.watch(accountAssetProvider(accountSequence)); // 提取数据和加载状态 - final isLoading = assetAsync.isLoading; + final isLoading = assetAsync.isLoading || accountSequence.isEmpty; final asset = assetAsync.valueOrNull; return Scaffold( @@ -38,7 +40,7 @@ class AssetPage extends ConsumerWidget { builder: (context, constraints) { return RefreshIndicator( onRefresh: () async { - ref.invalidate(myAssetProvider); + ref.invalidate(accountAssetProvider(accountSequence)); }, child: SingleChildScrollView( physics: const AlwaysScrollableScrollPhysics(),