update info
This commit is contained in:
@@ -88,6 +88,41 @@ class UserInfoRepositoryImpl implements UserInfoRepository {
|
||||
throw ServerException('Failed to refresh user info: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// UPDATE USER INFO
|
||||
// =========================================================================
|
||||
|
||||
@override
|
||||
Future<UserInfo> updateUserInfo(Map<String, dynamic> data) async {
|
||||
try {
|
||||
_debugPrint('Updating user info via API');
|
||||
_debugPrint('Update data: $data');
|
||||
|
||||
// Update via remote datasource (will fetch fresh data after update)
|
||||
final userInfoModel = await remoteDataSource.updateUserInfo(data);
|
||||
|
||||
_debugPrint('Successfully updated user info: ${userInfoModel.fullName}');
|
||||
|
||||
// Convert model to entity
|
||||
return userInfoModel.toEntity();
|
||||
} on UnauthorizedException catch (e) {
|
||||
_debugPrint('Unauthorized error on update: $e');
|
||||
rethrow;
|
||||
} on NotFoundException catch (e) {
|
||||
_debugPrint('Not found error on update: $e');
|
||||
rethrow;
|
||||
} on ServerException catch (e) {
|
||||
_debugPrint('Server error on update: $e');
|
||||
rethrow;
|
||||
} on NetworkException catch (e) {
|
||||
_debugPrint('Network error on update: $e');
|
||||
rethrow;
|
||||
} catch (e) {
|
||||
_debugPrint('Unexpected error on update: $e');
|
||||
throw ServerException('Failed to update user info: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user