[Vuejs]-Must click two times for Vue/Vuex to update array

0👍

The problem is here:

this.getAllByFilter(this.exportObj);

The Promise in this action was not handled anywhere. Return your Promise then await it.

const actions = {
    getAllByFilter({ commit }, exportObj) {
    return calendarService.getAllByFilter(exportObj)
        .then(
            events => commit('getAllSuccess', events),
            error => commit('getAllFailure', error)
        );
    },
};

Revise your Export method to:

async Export (item) {
  this.exportObj = {
    start: this.dates[0],
    end: this.dates[1],
    userid: item.id,
  };

  await this.getAllByFilter(this.exportObj);
  ....

Show a progress bar, loading dialog, or disable the button until the Export method finishes its job.

Leave a comment