mutations.js 658 Bytes
import * as Types from './types';

export default {
  [Types.FETCH_ORDER_PRODUCT_REQUEST](state) {
    state.orderInfo = {};
    state.fetchingPro = true;
  },
  [Types.FETCH_ORDER_PRODUCT_FAILED](state) {
    state.fetchingPro = false;
  },
  [Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh}) {
    state.fetchingPro = false;

    if (order.productInfo && state.productInfo.productId !== order.productInfo.productId || refresh) {
      state.productInfo = order.productInfo || state.productInfo;
    }

    if (refresh) {
      state.skcs = order.data;
    } else if (order.data) {
      state.skcs = state.skcs.concat(order.data);
    }
  },
};