sync page

This commit is contained in:
efrilm
2025-10-24 23:20:41 +07:00
parent 6892895021
commit 79e109cfe4
10 changed files with 669 additions and 63 deletions
@@ -347,4 +347,32 @@ class ProductRepository implements IProductRepository {
return left(ProductFailure.dynamicErrorMessage(e.toString()));
}
}
@override
Future<Either<ProductFailure, ListProduct>> getRemoteProducts({
int page = 1,
int limit = 10,
String? categoryId,
String? search,
}) async {
try {
final result = await _remoteDataProvider.fetchProducts(
page: page,
limit: limit,
categoryId: categoryId,
search: search,
);
if (result.hasError) {
return left(result.error!);
}
final products = result.data!.toDomain();
return right(products);
} catch (e, s) {
log('getProducts', name: _logName, error: e, stackTrace: s);
return left(const ProductFailure.unexpectedError());
}
}
}