This code is working great for getting member roles
import wixUsers from 'wix-users'; $w.onReady(function () {
wixUsers.currentUser.getRoles() .then((roles) => {
console.log('Received '+roles.length+' roles');
for (let i = 0 ; i < roles.length ; i++) {
console.log(roles[i]);
}
})
});
My issue is if someone has multiple roles my output shows them correctly, my console log will show
Role 1
Role 2
Role 3
My issue is, I want to see if they are Role 1 do this. What I have tried is:
if(role[i]=== role1){
// function here
}
But this doesn’t seem to be working correctly. am I missing something?