From 4dffff999d4025ddb593f5f44bf4ecccf577a0e5 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sat, 12 Sep 2020 14:10:57 -0400 Subject: basic product editing view with renaming --- iridescence/src/store/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'iridescence/src/store') 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: {} -- cgit v1.2.3