enable group, show accessible users and peers

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-09-14 10:17:03 +08:00
parent 09d380ba8f
commit b2a4f11e0b
53 changed files with 568 additions and 273 deletions

View File

@@ -45,7 +45,7 @@ class UserModel {
refreshingUser = false;
final status = response.statusCode;
if (status == 401 || status == 400) {
reset(clearAbCache: status == 401);
reset(resetOther: status == 401);
return;
}
final data = json.decode(utf8.decode(response.bodyBytes));
@@ -84,11 +84,13 @@ class UserModel {
}
}
Future<void> reset({bool clearAbCache = false}) async {
Future<void> reset({bool resetOther = false}) async {
await bind.mainSetLocalOption(key: 'access_token', value: '');
await bind.mainSetLocalOption(key: 'user_info', value: '');
if (clearAbCache) await bind.mainClearAb();
await gFFI.groupModel.reset();
if (resetOther) {
await gFFI.abModel.reset();
await gFFI.groupModel.reset();
}
userName.value = '';
}
@@ -120,7 +122,7 @@ class UserModel {
} catch (e) {
debugPrint("request /api/logout failed: err=$e");
} finally {
await reset(clearAbCache: true);
await reset(resetOther: true);
gFFI.dialogManager.dismissByTag(tag);
}
}