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:
parent
d43a70de93
commit
5eae4464ef
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue