Skip to content

Commit 411571d

Browse files
committed
Update useProductsStore.js
1 parent ea9faa7 commit 411571d

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

store/useProductsStore.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ export const useProductsStore = defineStore("products", {
5959
});
6060
},
6161
getUniqueProductTypes(state) {
62-
const productTypes = state.products.flatMap(p => p.productCategories.nodes);
63-
const unique = [];
64-
const map = new Map();
65-
for (const item of productTypes) {
66-
if(!map.has(item.id)){
67-
map.set(item.id, true);
68-
unique.push({
69-
id: item.id,
70-
name: item.name,
71-
checked: false
72-
});
73-
}
62+
const productTypes = state.products.flatMap((p) => p.productCategories.nodes);
63+
const unique = [];
64+
const map = new Map();
65+
for (const item of productTypes) {
66+
if (!map.has(item.id)) {
67+
map.set(item.id, true);
68+
unique.push({
69+
id: item.id,
70+
name: item.name,
71+
checked: false,
72+
});
7473
}
75-
return unique;
76-
}
74+
}
75+
return unique;
76+
},
7777
},
7878

7979
actions: {
@@ -104,16 +104,16 @@ export const useProductsStore = defineStore("products", {
104104
this.priceRange = range;
105105
},
106106
toggleProductType(id) {
107-
const productType = this.productTypes.find(pt => pt.id === id);
108-
if (productType) {
109-
productType.checked = !productType.checked;
110-
}
107+
const productType = this.productTypes.find((pt) => pt.id === id);
108+
if (productType) {
109+
productType.checked = !productType.checked;
110+
}
111111
},
112112
resetFilters() {
113-
this.selectedSizes = [];
114-
this.selectedColors = [];
115-
this.priceRange = [0, 1000];
116-
this.productTypes.forEach(pt => pt.checked = false);
117-
}
113+
this.selectedSizes = [];
114+
this.selectedColors = [];
115+
this.priceRange = [0, 1000];
116+
this.productTypes.forEach((pt) => (pt.checked = false));
117+
},
118118
},
119119
});

0 commit comments

Comments
 (0)