fix(mining-app): remove unnecessary token refresh on app startup

Users were being redirected to login page when clicking navigation
because the background token refresh was failing and clearing user state.

Token refresh should only happen when API returns 401, not on every app launch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-13 20:28:07 -08:00
parent d43a70de93
commit 5eae4464ef
1 changed files with 2 additions and 3 deletions

View File

@ -33,12 +33,11 @@ class _SplashPageState extends ConsumerState<SplashPage> {
final userState = ref.read(userNotifierProvider);
if (userState.isLoggedIn) {
// token
// token
// token API 401
if (mounted) {
context.go(Routes.contribution);
}
// token API 401
ref.read(userNotifierProvider.notifier).refreshTokenIfNeeded();
} else {
context.go(Routes.login);
}