I want to automatically get my users to their special member page (in a router page), based on their current role.
Most works just fine, just that I do not have any clue why the call to getRoles on current user executes the error handler although I am making near plain vanilla calls. Any help more than super welcome ;).
My code:
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;
$w.onReady( function () {
//TODO: write your page related code here… if (wixWindow.rendering.renderCycle === 1) { const user = wixUsers.currentUser;
user.getRoles()
.then(roles => {
console.log(“ROLES: “+JSON.stringify(roles)); if (roles.length===1){ if (roles[0].name===“Company”) return wixLocation.to(”/company/dashboard”) if (roles[0].name===“Student”) return wixLocation.to(“/student/dashboard”) if (roles[0].name===“Staff”) return wixLocation.to(“/staff/dashboard”)
} else {
console.log(“roles.length !== 1”);
}
}, err => {
console.log(“user.getRoles ERROR”); // yep I see you
console.log(JSON.stringify(err)); // I get an empty object: {}
})
}
});
Is it because of the change in where they put it on the dashboard of each individual site??
They recently changed the way the site dashboard is setup and changed the wording and placement around for different things inside of Customer Management…
OMG, never saw that coming… I am surprised they would put it in production without regression testing or if there is breaking change without giving prior notice. Where did you get that information?
@martin86078 To be honest, I am on wix platform like 24/7 and notice a whole bunch of changes that goes on inside the system so that is why I could highlight the change. I wish they could send out emails to people about the change or at least notify us that they are in the progress of changing the structure and look.
I guess we will just have to wait for someone from wix to reply or at least notify us on this thread.