♻️ Refactored auth system
This commit is contained in:
@ -23,7 +23,7 @@ class _RealmDeletionDialogState extends State<RealmDeletionDialog> {
|
||||
|
||||
Future<void> deleteRealm() async {
|
||||
final AuthProvider auth = Get.find();
|
||||
if (!await auth.isAuthorized) return;
|
||||
if (auth.isAuthorized.isFalse) return;
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
@ -41,7 +41,7 @@ class _RealmDeletionDialogState extends State<RealmDeletionDialog> {
|
||||
|
||||
Future<void> leaveRealm() async {
|
||||
final AuthProvider auth = Get.find();
|
||||
if (!await auth.isAuthorized) return;
|
||||
if (auth.isAuthorized.isFalse) return;
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
|
@ -29,10 +29,9 @@ class _RealmMemberListPopupState extends State<RealmMemberListPopup> {
|
||||
|
||||
void getProfile() async {
|
||||
final AuthProvider auth = Get.find();
|
||||
if (!await auth.isAuthorized) return;
|
||||
if (auth.isAuthorized.isFalse) return;
|
||||
|
||||
final prof = await auth.getProfile();
|
||||
setState(() => _accountId = prof.body['id']);
|
||||
setState(() => _accountId = auth.userProfile.value!['id']);
|
||||
}
|
||||
|
||||
void getMembers() async {
|
||||
@ -69,7 +68,7 @@ class _RealmMemberListPopupState extends State<RealmMemberListPopup> {
|
||||
|
||||
void addMember(String username) async {
|
||||
final AuthProvider auth = Get.find();
|
||||
if (!await auth.isAuthorized) return;
|
||||
if (auth.isAuthorized.isFalse) return;
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
@ -90,7 +89,7 @@ class _RealmMemberListPopupState extends State<RealmMemberListPopup> {
|
||||
|
||||
void removeMember(RealmMember item) async {
|
||||
final AuthProvider auth = Get.find();
|
||||
if (!await auth.isAuthorized) return;
|
||||
if (auth.isAuthorized.isFalse) return;
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
|
Reference in New Issue
Block a user