🔥 Finish Cart implementation
- Use Select component in CartItem to change quantity - Visual update when removing or changing an item quantity - API: Remove Cart item action - API: Handle Cart item adding and updating (quantity)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { addToCart, createCart, fetchCart, getProduct, updateCartItem } from '$utils/swellFunctions'
|
||||
import { addToCart, createCart, fetchCart, getProduct, removeCartItem, updateCartItem } from '$utils/swellFunctions'
|
||||
|
||||
|
||||
// Block GET requests
|
||||
@@ -41,11 +41,13 @@ export async function post ({ headers, query, body, params, ...rest }) {
|
||||
result = await updateCartItem(cartId, productId, bodyParsed.quantity)
|
||||
break
|
||||
}
|
||||
|
||||
case 'removeCartItem': {
|
||||
result = await removeCartItem(cartId, productId)
|
||||
break
|
||||
}
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
body: result,
|
||||
|
||||
Reference in New Issue
Block a user