diff options
author | Adam T. Carpenter <atc@53hor.net> | 2020-11-13 10:05:48 -0500 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2020-11-13 10:05:48 -0500 |
commit | 23272d18ef2eccd1a451bbd2aefb1f067b30962b (patch) | |
tree | 24ecb5f7b5a99e17271145de796969ecb34f8bdd /iridescence/src/store | |
parent | 9b77f9ec2c00b48c551f65b2e9d7a087004de4c0 (diff) | |
download | theglassyladies-23272d18ef2eccd1a451bbd2aefb1f067b30962b.tar.xz theglassyladies-23272d18ef2eccd1a451bbd2aefb1f067b30962b.zip |
basic sorting functional; swapped indexes for ids in edit list
Diffstat (limited to 'iridescence/src/store')
-rw-r--r-- | iridescence/src/store/index.js | 24 |
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) { |