fix:登录退出页

This commit is contained in:
jingyun
2026-06-07 11:38:08 +08:00
parent 6a7fa5a067
commit 6c943f8394
8 changed files with 356 additions and 38 deletions
+12 -4
View File
@@ -49,7 +49,11 @@ class AuthController extends StateNotifier<AuthState> {
final UserStateRepository _repository;
Future<void> _load() async {
state = state.copyWith(loggedIn: await _repository.isLoggedIn());
state = state.copyWith(
loggedIn: await _repository.isLoggedIn(),
phone: await _repository.getPhone(),
loginMethod: await _repository.getLoginMethod(),
);
}
void requireLogin(PendingLoginAction action) {
@@ -57,10 +61,14 @@ class AuthController extends StateNotifier<AuthState> {
state = state.copyWith(pendingAction: action);
}
Future<PendingLoginAction?> login(LoginMethod method) async {
Future<PendingLoginAction?> login(LoginMethod method, {String? phone}) async {
final pending = state.pendingAction;
await _repository.login(method);
state = const AuthState(loggedIn: true);
await _repository.login(method, phone: phone);
state = AuthState(
loggedIn: true,
phone: phone ?? await _repository.getPhone(),
loginMethod: method,
);
return pending;
}