after rediense

This commit is contained in:
Felipe
2024-02-26 16:32:31 -05:00
parent a1e367bdf3
commit 11d9ee6d35
11 changed files with 256 additions and 223 deletions
+10 -9
View File
@@ -30,15 +30,16 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
UpdateUserInfo event, Emitter<ProfileState> emit) async {
emit(UpdateUserInfoLoading());
try {
await _userRepository.updateUserInfo(event.userId, event.picture, {
'name': event.name,
// 'picture': event.picture,
'nickname': event.nickname,
'email': event.email,
'phone': event.phone,
'birthDate': event.birthDate,
'gender': event.gender
});
final userImageUrl = event.filePicture != null
? await _userRepository.uploadPicture(
event.filePicture!, event.myUser.id)
: null;
final myUser = userImageUrl == null
? event.myUser
: event.myUser.copyWith(picture: userImageUrl);
await _userRepository.updateUserInfo(myUser);
emit(const UpdateUserInfoSuccess());
} catch (e) {
emit(UpdateUserInfoFailure());