feat(account): 同步资料保存后的登录态
This commit is contained in:
1 parent
44f6feb249
commit
ef7f4ce3b6
2 files changed
+79
No files matched your search
@@ -90,6 +90,20 @@ class AuthController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 资料保存成功后同步登录态摘要,保留当前令牌。
|
||||
Future<void> applyProfile(AuthUser user) async {
|
||||
final current = _session;
|
||||
if (current == null) return;
|
||||
await _apply(
|
||||
AuthSession(
|
||||
accessToken: current.accessToken,
|
||||
refreshToken: current.refreshToken,
|
||||
expiresIn: current.expiresIn,
|
||||
user: user,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _apply(AuthSession session) async {
|
||||
_session = session;
|
||||
await _store.save(session);
|
||||
|
||||
Reference in new issue
Block a user