Link to Page Depending on Member Permission

Hi Sam!

I really appreciate your reply. As someone very new to Corvid/Javascript, I ran into a couple of issues. I put the back end function, but then I didn’t quite know how to use the roles once that function had pulled it…

Anyhow after a lot of research today I managed to combine some info for a slightly different solution:

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixData from 'wix-data'; 

export function But_click(event) {

let user = wixUsers.currentUser;
user.getRoles()
.then( (roles) => {

let userRole = user.role;

if(roles.some(r => {return(r.name ===  "Customer")}) ===true) {wixLocation.to("/Customer-Area");}    

if(roles.some(r => {return(r.name ===  "Partner")}) ===true) {wixLocation.to("/Partners-Area");} 
})
}

This way upon clicking the Button, it sends users to the relevant link depending on their role.

Very pleased to do this… and whilst I didn’t manage from yours, it did get me totally inspired to learn enough to figure this one out, so very grateful!! =)