Show repeater depending on Member Status

Hi,

Please see the following code. I have 2 repeaters on a dynamic page, one for members and another for non-site members. When I test it, it doesn’t work. Any help would be great, many thanks in advance.

// API Reference: Introduction - Velo API Reference - Wix.com
// “Hello, World!” Example: Velo Learning Center
import wixLocation from ‘wix-location’ ;
import wixUsers from ‘wix-users’ ;

wixUsers . onLogin (( user ) => {
let userId = user . id ; // “r5cme-6fem-485j-djre-4844c49”
let isLoggedIn = user . loggedIn ; // true
let userRole = user . role ;
if ( wixUsers . currentUser . loggedIn ) {
wixLocation . to ( wixLocation . url );
}
});

$w . onReady ( function () {

let user = wixUsers . currentUser ;
let userId = user . id ;
let isLoggedIn = user . loggedIn ;

user . getPricingPlans ()
. then ( ( pricingPlans ) => {
let firstPlan = pricingPlans [ 0 ];
let planName = firstPlan . name ;

if ( planName === “Associate” ) {
//member_restriction
$w ( “#NoMemberAccess” ). show ();

//paid_access
$w ( “#MemberAccess” ). hide ();

}
else {
//member restrictions
$w ( “#NoMemberAccess” ). hide ();

//paid_access
$w ( “#MemberAccess” ). show ();

}}
)})