diff --git a/lib/ui/profile/view/profile_view.dart b/lib/ui/profile/view/profile_view.dart index 8c0c901..cd55584 100644 --- a/lib/ui/profile/view/profile_view.dart +++ b/lib/ui/profile/view/profile_view.dart @@ -72,6 +72,8 @@ class Profile extends StatelessWidget { Widget _buildProfileHeader(BuildContext context) { ProfileViewModel viewModel = Provider.of(context); + viewModel.getUserCommand.execute(); + return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/ui/profile/viewmodel/profile_viewmodel.dart b/lib/ui/profile/viewmodel/profile_viewmodel.dart index 5d7abf1..14c0835 100644 --- a/lib/ui/profile/viewmodel/profile_viewmodel.dart +++ b/lib/ui/profile/viewmodel/profile_viewmodel.dart @@ -11,15 +11,14 @@ class ProfileViewModel extends ChangeNotifier { late Command0 logoutCommand; late Command0 getUserCommand; - ProfileViewModel() { logoutCommand = Command0(logout); getUserCommand = Command0(getUser); - } Future> logout() async { await StorageValue.getInstance().clear(); + await GetIt.instance().clearUser(); Log.d("Usuário deslogado com sucesso."); return Result.value(null); @@ -29,5 +28,4 @@ class ProfileViewModel extends ChangeNotifier { UserModel user = await GetIt.instance().getUser(); return Result.value(user); } - }