summaryrefslogtreecommitdiff
path: root/iridescence/src/store/index.js
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2020-11-13 10:05:48 -0500
committerAdam T. Carpenter <atc@53hor.net>2020-11-13 10:05:48 -0500
commit23272d18ef2eccd1a451bbd2aefb1f067b30962b (patch)
tree24ecb5f7b5a99e17271145de796969ecb34f8bdd /iridescence/src/store/index.js
parent9b77f9ec2c00b48c551f65b2e9d7a087004de4c0 (diff)
downloadtheglassyladies-23272d18ef2eccd1a451bbd2aefb1f067b30962b.tar.xz
theglassyladies-23272d18ef2eccd1a451bbd2aefb1f067b30962b.zip
basic sorting functional; swapped indexes for ids in edit list
Diffstat (limited to 'iridescence/src/store/index.js')
-rw-r--r--iridescence/src/store/index.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/iridescence/src/store/index.js b/iridescence/src/store/index.js
index 19205c9..d0d04cb 100644
--- a/iridescence/src/store/index.js
+++ b/iridescence/src/store/index.js
@@ -11,31 +11,31 @@ export default new Vuex.Store({
searchTerm: "",
products: [],
busy: false,
- progress: 100
+ compare: () => 0
},
getters: {
busy(state) {
return state.busy;
},
- progress(state) {
- return state.progress;
- },
products(state) {
- return state.products.filter(item => {
- return JSON.stringify(item)
- .toLowerCase()
- .includes(state.searchTerm.toLowerCase());
- });
+ return state.products
+ .filter(item => {
+ return JSON.stringify(item)
+ .toLowerCase()
+ .includes(state.searchTerm.toLowerCase());
+ })
+ .sort(state.compare);
}
},
mutations: {
toggleBusy(state) {
state.busy = !state.busy;
},
+ compare(state, compare) {
+ state.compare = compare;
+ },
searchTerm(state, term) {
- if (term) {
- state.searchTerm = term;
- }
+ state.searchTerm = term;
},
setProducts(state, products) {
if (products) {