mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 11:06:57 +00:00
Merge pull request #4809 from dignow/refact/login_dialog
Immediately show the login dialog
This commit is contained in:
@@ -10,7 +10,7 @@ import '../common.dart';
|
||||
import 'model.dart';
|
||||
import 'platform_model.dart';
|
||||
|
||||
bool refresing_user = false;
|
||||
bool refreshingUser = false;
|
||||
|
||||
class UserModel {
|
||||
final RxString userName = ''.obs;
|
||||
@@ -31,16 +31,16 @@ class UserModel {
|
||||
'id': await bind.mainGetMyId(),
|
||||
'uuid': await bind.mainGetUuid()
|
||||
};
|
||||
if (refresing_user) return;
|
||||
if (refreshingUser) return;
|
||||
try {
|
||||
refresing_user = true;
|
||||
refreshingUser = true;
|
||||
final response = await http.post(Uri.parse('$url/api/currentUser'),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer $token'
|
||||
},
|
||||
body: json.encode(body));
|
||||
refresing_user = false;
|
||||
refreshingUser = false;
|
||||
final status = response.statusCode;
|
||||
if (status == 401 || status == 400) {
|
||||
reset();
|
||||
@@ -57,7 +57,7 @@ class UserModel {
|
||||
} catch (e) {
|
||||
debugPrint('Failed to refreshCurrentUser: $e');
|
||||
} finally {
|
||||
refresing_user = false;
|
||||
refreshingUser = false;
|
||||
await updateOtherModels();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user