summaryrefslogtreecommitdiff
path: root/iridescence/src/store/index.js
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2020-09-12 14:10:57 -0400
committerAdam T. Carpenter <atc@53hor.net>2020-09-12 14:10:57 -0400
commit4dffff999d4025ddb593f5f44bf4ecccf577a0e5 (patch)
tree289a241347e24b0f0963e91256e2b44b70db3ee0 /iridescence/src/store/index.js
parent92b5b5cc69fdd3dfe67ea07a0fcf26bdd3c930f8 (diff)
downloadtheglassyladies-4dffff999d4025ddb593f5f44bf4ecccf577a0e5.tar.xz
theglassyladies-4dffff999d4025ddb593f5f44bf4ecccf577a0e5.zip
basic product editing view with renaming
Diffstat (limited to 'iridescence/src/store/index.js')
-rw-r--r--iridescence/src/store/index.js11
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: {}