Skip to content

Commit

Permalink
fix(#58): corrige erros
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCostaDeOliveira committed Jan 25, 2025
1 parent 95f3138 commit e7ce37e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/ui/profile/view/profile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class Profile extends StatelessWidget {
Widget _buildProfileHeader(BuildContext context) {
ProfileViewModel viewModel = Provider.of<ProfileViewModel>(context);

viewModel.getUserCommand.execute();

return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand Down
4 changes: 1 addition & 3 deletions lib/ui/profile/viewmodel/profile_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ class ProfileViewModel extends ChangeNotifier {
late Command0<void> logoutCommand;
late Command0<UserModel> getUserCommand;


ProfileViewModel() {
logoutCommand = Command0<void>(logout);
getUserCommand = Command0<UserModel>(getUser);

}

Future<Result<void>> logout() async {
await StorageValue.getInstance().clear();
await GetIt.instance<AuthRepository>().clearUser();

Log.d("Usuário deslogado com sucesso.");
return Result.value(null);
Expand All @@ -29,5 +28,4 @@ class ProfileViewModel extends ChangeNotifier {
UserModel user = await GetIt.instance<AuthRepository>().getUser();
return Result.value(user);
}

}

0 comments on commit e7ce37e

Please sign in to comment.