sync page
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user