import { createSlice } from "@reduxjs/toolkit";

export const cartSlice = createSlice({
  name: "cart",
  initialState: {
    item: [],
  },
  reducers: {
    addCart(state, action) {
      console.log(action);
      state.item.push(action.payload.data);
      action.payload.openNotification()
    },
  },
});
// each case under reducers becomes an action
export const { addCart } = cartSlice.actions;
export default cartSlice.reducer;
