mutations.js 480 B

12345678910111213141516
  1. import * as types from '../../types';
  2. export default {
  3. [types.UPDATE_DISTRIBUTORS]: (state, payload) => {
  4. Vue.set(state, 'distributors', payload);
  5. },
  6. [types.UPDATE_DISTRIBUTOR]: (state, payload) => {
  7. if (payload.id) {
  8. state.distributors.forEach(distributor => {
  9. if (distributor.id === payload.id) {
  10. distributor = Object.assign(distributor, payload);
  11. }
  12. });
  13. }
  14. }
  15. };