Estoy tratando de usar el valor de mapGetters en mi otra propiedad calculada. Se muestra nulo porque el método de preferencias no se ejecutó completado. Quiero esperar hasta que la tienda configure el getter y el setter. Intenté async/await pero no funciona
mounted() { this.preferences(); this.selectedColumnsHeader; }, methods: { async preferences() { await this.$store.dispatch('fetchPreferences'); } }Tienda
fetchPreferences({ commit }) { return http .get('/help_ticket_preferences.json') .then((res) => { commit('setPreferences', res.data.preference); }) .catch((error) => { commit('setErrorMessage', `Sorry, there was an error fetching help ticket preferences ${error.message}.`); }); },En primer lugar, debe esperar this.preferences() en mounted
async mounted() { await this.preferences(); this.selectedColumnsHeader; }, en segundo lugar, debe devolver una Promesa en fetchPreferences
fetchPreferences({ commit }) { return http .get('/help_ticket_preferences.json') ..... etcAzada eso ayuda