I have a somewhat strange situation, or I think I do not understand what is going on because it does not enter the if
I am using the var this.searchParams.data
where 3 situations happen
Then I'm using the indexOf for the simple reason that we use ES5
But it comes as an object
{sortBy: "price_asc"}
But no matter how hard you try that when it is not defined or does not exist it does not enter if
to show the products ...
this.searchParams = window.getSearch();
this.searchSortBy = Object.values(this.searchParams.data)[0];
console.log('-----------1-----------');
console.log(typeof this.searchSortBy.indexOf('price') == null);
console.log('-----------2-----------');
console.log(this.searchSortBy.indexOf('price') === "undefined");
console.log('-----------3-----------');
console.log(typeof this.searchSortBy.indexOf('price') == null);
if (!this.searchParams.data.price && typeof this.searchSortBy.indexOf('price') == null) {
this.getProducts();
}
I would really appreciate the help.