diff --git a/resources/js/store/modules/productos.js b/resources/js/store/modules/productos.js index 2bf3443..27794c1 100644 --- a/resources/js/store/modules/productos.js +++ b/resources/js/store/modules/productos.js @@ -36,10 +36,8 @@ const actions = { commit('setFiltro', null); commit('setProductos', response.data.data); }, - async seleccionarCategoria({ commit }, { categoria }) { - const response = await axios.get("/api/productos"); - commit('setFiltro', { clave: "categoria", valor: categoria }); - commit('setProductos', response.data.data); + async seleccionarCategoria({ dispatch }, { categoria }) { + dispatch('filtrarProductos', { filtro: "categoria", valor: categoria }); }, async filtrarProductos({ commit }, { filtro, valor }) { const response = await axios.get("/api/productos", {