actions.js 192 B

123456789
  1. import * as types from './mutation-types'
  2. export const addToCart = ({ commit }, product) => {
  3. if (product.inventory > 0) {
  4. commit(types.ADD_TO_CART, {
  5. id: product.id
  6. })
  7. }
  8. }