Fixed duplicate ajax request for category max-price

This commit is contained in:
jitendra 2022-09-14 17:37:40 +05:30
parent 4832b09ae9
commit 1e7409c255
1 changed files with 11 additions and 5 deletions

View File

@ -176,18 +176,25 @@
data: function() {
return {
active: false,
appliedFilters: [],
sliderConfig: {
max: 500,
value: [0, 0],
processStyle: {
"backgroundColor": "#FF6472"
},
tooltipStyle: {
"borderColor": "#FF6472",
"backgroundColor": "#FF6472",
},
priceTo: 0,
priceFrom: 0,
}
}
@ -213,17 +220,16 @@
methods: {
setMaxPrice: function () {
if (this.attribute['code'] != 'price') {
return;
}
axios
.get(this.maxPriceSrc)
.then((response) => {
let maxPrice = response.data.max_price;
this.sliderConfig.max = maxPrice ? ((parseInt(maxPrice) !== 0 || maxPrice) ? parseInt(maxPrice) : 500) : 500;
if (! this.appliedFilterValues) {
this.sliderConfig.value = [0, this.sliderConfig.max];
this.sliderConfig.priceTo = this.sliderConfig.max;
}
});
},