🐛 Fix unauthorized things

This commit is contained in:
LittleSheep 2024-09-15 16:54:07 +08:00
parent 306ce9e2b4
commit aeaade9590
2 changed files with 3 additions and 1 deletions

View File

@ -216,6 +216,7 @@ class AuthProvider extends GetConnect {
} }
Future<void> refreshUserProfile() async { Future<void> refreshUserProfile() async {
if (!isAuthorized.value) return;
final client = configureClient('auth'); final client = configureClient('auth');
final resp = await client.get('/users/me'); final resp = await client.get('/users/me');
if (resp.statusCode != 200) { if (resp.statusCode != 200) {

View File

@ -204,7 +204,8 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_getStatus(); final AuthProvider auth = Get.find();
if (auth.isAuthorized.value) _getStatus();
Future.delayed(Duration.zero, () => _autoResize()); Future.delayed(Duration.zero, () => _autoResize());
_drawerAnimationController.addListener(() { _drawerAnimationController.addListener(() {
if (_drawerAnimation.value > 180 && _isCollapsed) { if (_drawerAnimation.value > 180 && _isCollapsed) {