| 1234567891011121314151617181920 |
- import * as types from '../../types';
- import Vue from 'vue';
- import {cloneDeep} from 'lodash';
- export default {
- [types.UPDATE_DISTRIBUTORS]: (state, payload) => {
- Vue.set(state, 'distributors', payload);
- },
- [types.UPDATE_DISTRIBUTOR]: (state, payload) => {
- if (payload.id) {
- state.distributors.forEach( (distributor, index) => {
- if (distributor.id === payload.id) {
- Vue.set(state.distributors, index, payload.distributor[payload.id]);
- }
- });
- } else {
- Vue.set(state.distributors, state.distributors.length, payload.distributor);
- }
- }
- };
|