From aeaade95902b5c482d7a58342ffe938d70ab228e Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 15 Sep 2024 16:54:07 +0800 Subject: [PATCH] :bug: Fix unauthorized things --- lib/providers/auth.dart | 1 + lib/widgets/navigation/app_navigation_drawer.dart | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/providers/auth.dart b/lib/providers/auth.dart index 25801f7..ebc07f6 100644 --- a/lib/providers/auth.dart +++ b/lib/providers/auth.dart @@ -216,6 +216,7 @@ class AuthProvider extends GetConnect { } Future refreshUserProfile() async { + if (!isAuthorized.value) return; final client = configureClient('auth'); final resp = await client.get('/users/me'); if (resp.statusCode != 200) { diff --git a/lib/widgets/navigation/app_navigation_drawer.dart b/lib/widgets/navigation/app_navigation_drawer.dart index fcd65f8..2373226 100644 --- a/lib/widgets/navigation/app_navigation_drawer.dart +++ b/lib/widgets/navigation/app_navigation_drawer.dart @@ -204,7 +204,8 @@ class _AppNavigationDrawerState extends State @override void initState() { super.initState(); - _getStatus(); + final AuthProvider auth = Get.find(); + if (auth.isAuthorized.value) _getStatus(); Future.delayed(Duration.zero, () => _autoResize()); _drawerAnimationController.addListener(() { if (_drawerAnimation.value > 180 && _isCollapsed) {