Role Filtering isnt working

I have a repeater hidden and I want it show with certain roles but I can seem to get it to work.

import wixData from ‘wix-data’ ;
import wixUsers from ‘wix-users’ ;
$w.onReady( function () {
const currentUser = wixUsers.currentUser;
if (currentUser.role === ‘Admin’ ) {
$w( ‘#listRepeater’ ).show();
}
})

Hi.

Kindly note that t his( currentUser.role ) property has been deprecated. Use the getRoles() function instead.

You should also note that these APIs in wix-users are only partially functional when previewing your site. View a published version of your site to see their complete functionality. Refer to our API by clicking the respective links above to learn more.

Good luck!