Conditionally show button

Hi,

Following up on above, I wrote below code and put the button to hidden in the properties panel. However, it looks like the code is not running. Would someone be able to help?

Many thanks!

import { currentMember } from ‘wix-members’ ;
import wixData from ‘wix-data’ ;

$w . onReady ( function () {
let currentUser = currentMember ;
function checkDB ( ){
wixData . query ( “alumni_profiles” )
. eq ( “user” , currentUser )
. find ()
. then ( ( results ) => {
if ( results . items . length > 0 ){
$w ( ‘#changeprofile’ ). show ();
}
else {
$w ( ‘#changeprofile’ ). hide ();
}
} )
. catch ( ( err ) => {
let errorMsg = err ;
} );
}
})