I wrote this code to filter images relative to the user and the selected category.
All this so that one user’s content doesn’t mix with another’s.
The code recognizes both the user and the category correctly but does not filter.
Could anyone take a look and tell me where I went wrong ??
Thanks!
import wixData from 'wix-data';
import wixUsers from 'wix-users';
let utente;
let categoria;
$w.onReady(function () {
let utilizzatore = wixUsers.currentUser.id;
console.log(utilizzatore)
});
function filtering (category, user) {
var newFilter = wixData.filter();
newFilter = newFilter.eq('categoria', category);
newFilter = newFilter.eq('cliente', user);
$w('#dbAcquisti').setFilter(newFilter);
console.log(newFilter)
utente = user
categoria = category
}
export function iptDropdown_change(event) {
let adjGenre;
let currentUser = $w("#dbClienti").getCurrentItem().nome;
console.log(currentUser)
if ($w('#iptDropdown').value !== 'tutti') {
adjGenre = $w('#iptDropdown').value;
}
filtering(adjGenre, currentUser);
}