diff options
author | 2024-09-11 16:30:19 +0100 | |
---|---|---|
committer | 2024-09-11 16:30:19 +0100 | |
commit | c1a0d14ba20f26b45d0758633c5395531b7182de (patch) | |
tree | 236ea42e816460dd8965fdee8c23d38fdc548bb7 | |
parent | Allow cart items to add themselves to the cart (diff) |
Add new cart action to set the max price
-rw-r--r-- | thallium-frontend/src/slices/cart.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/thallium-frontend/src/slices/cart.ts b/thallium-frontend/src/slices/cart.ts index 715fef4..8761955 100644 --- a/thallium-frontend/src/slices/cart.ts +++ b/thallium-frontend/src/slices/cart.ts @@ -11,6 +11,7 @@ const cartSlice = createSlice({ name: "cart", initialState: { cart: [] as CartItem[], + maxPrice: null as number | null, }, reducers: { addCartItem(state, action: { payload: { product_template_id: number, variant_id: number, estPrice: string } }) { @@ -38,9 +39,12 @@ const cartSlice = createSlice({ } } }, + setMaxPrice(state, action: { payload: number }) { + state.maxPrice = action.payload; + } }, }); -export const { addCartItem, removeCartItem } = cartSlice.actions; +export const { addCartItem, removeCartItem, setMaxPrice } = cartSlice.actions; export default cartSlice.reducer; |