fix:登录退出页
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user