add firebase, add screen flow

This commit is contained in:
Phuoc Nguyen
2025-12-03 11:07:33 +07:00
parent 9fb4ba621b
commit cae04b3ae7
22 changed files with 504 additions and 131 deletions

View File

@@ -16,8 +16,8 @@ abstract class CartRemoteDataSource {
/// Add items to cart
///
/// [items] - List of items with item_id, quantity, and amount
/// Returns list of cart items from API
Future<List<CartItemModel>> addToCart({
/// Returns true if successful
Future<bool> addToCart({
required List<Map<String, dynamic>> items,
});
@@ -47,7 +47,7 @@ class CartRemoteDataSourceImpl implements CartRemoteDataSource {
final DioClient _dioClient;
@override
Future<List<CartItemModel>> addToCart({
Future<bool> addToCart({
required List<Map<String, dynamic>> items,
}) async {
try {
@@ -78,8 +78,7 @@ class CartRemoteDataSourceImpl implements CartRemoteDataSource {
throw const ParseException('Invalid response format from add to cart API');
}
// After adding, fetch updated cart
return await getUserCart();
return true;
} on DioException catch (e) {
throw _handleDioException(e);
} catch (e) {