summaryrefslogtreecommitdiff
path: root/iridescence/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'iridescence/src/store')
-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) {