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 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-15 06:34:19 -08:00
parent 4cef31b1d1
commit 4b1855f57a
1 changed files with 5 additions and 3 deletions

View File

@ -24,10 +24,12 @@ class AssetPage extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final user = ref.watch(userNotifierProvider); 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; final asset = assetAsync.valueOrNull;
return Scaffold( return Scaffold(
@ -38,7 +40,7 @@ class AssetPage extends ConsumerWidget {
builder: (context, constraints) { builder: (context, constraints) {
return RefreshIndicator( return RefreshIndicator(
onRefresh: () async { onRefresh: () async {
ref.invalidate(myAssetProvider); ref.invalidate(accountAssetProvider(accountSequence));
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),