Help please: Button redirect

I am building a site, and one of the things I want to do is check if a user has reached a certain level, and if they have, let them move to a new page via a button click. If they haven’t, I want them to be redirected to a different page.

I have built this code thus far, but it doesn’t seem to work. (The requiredstep variable would be set for each as necessary manually):

export function button1_click(event) {
//Add your code for this event here:
var requiredstep = 1
let user = wixUsers.currentUser;
wixData.get(“User_At_Step”, user)
.then( (results) => {
let item = results;
let atstep = results.atStep;
if(atstep >= requiredstep) {
wixLocation.to(“/Clues/The-First-One”);
} else {
wixLocation.to(“/NotAcessibleYet”);
}
} )
.catch( (err) => {
let errorMsg = err;
} );
}