diff options
Diffstat (limited to 'iridescence/src/store')
-rw-r--r-- | iridescence/src/store/index.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/iridescence/src/store/index.js b/iridescence/src/store/index.js index e2b40b4..5a5b5f7 100644 --- a/iridescence/src/store/index.js +++ b/iridescence/src/store/index.js @@ -4,6 +4,8 @@ import Dichroism from "@/api/dichroism.js"; Vue.use(Vuex); +let dichroismApi = new Dichroism(); + export default new Vuex.Store({ state: { searchTerm: "", @@ -30,8 +32,13 @@ export default new Vuex.Store({ } }, actions: { - refreshProducts({ commit }) { - commit("setProducts", Dichroism.getProducts()); + refreshProducts(context) { + context.commit("setProducts", []); + context.commit("setProducts", dichroismApi.getProducts()); + }, + updateProduct(context, product) { + dichroismApi.updateProduct(product); + context.dispatch("refreshProducts"); } }, modules: {} |