1
This commit is contained in:
@@ -21,7 +21,7 @@ class AppStore with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///设置用户数据
|
||||
///设置数据
|
||||
Future<void> setInfo(LoginDto data) async {
|
||||
token = data.accessToken!;
|
||||
userInfo = data.userInfo;
|
||||
@@ -30,6 +30,17 @@ class AppStore with ChangeNotifier {
|
||||
await Storage.set('token', token);
|
||||
}
|
||||
|
||||
///更新用户信息
|
||||
void updateUserInfo(UserInfo value) async {
|
||||
userInfo = userInfo?.copyWith(
|
||||
name: value.name,
|
||||
avatar: value.avatar,
|
||||
description: value.description,
|
||||
);
|
||||
await Storage.set('userInfo', userInfo?.toJson());
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///获取token
|
||||
static Future<String> getToken() async {
|
||||
return await Storage.get("token") ?? '';
|
||||
|
||||
Reference in New Issue
Block a user