update info

This commit is contained in:
Phuoc Nguyen
2025-11-20 16:32:33 +07:00
parent 1fcef52d5e
commit dc85157758
12 changed files with 1613 additions and 247 deletions

View File

@@ -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');
}
}
}
// ============================================================================