Unique page redirection based on password (NOT using wix passwords)

Hello!
So I’m building my wedding website. I’m trying to do a login based on a password that I’ll send people in a physical invitation. This password will dictate what schedule people will see and forward them to a particular page. In trying to write this code, I’m having issues as the window.Location.href=’ ’ is not seeming to be recognized. I’ve also used the code wix.Location=’ ’ but it doesnt seem to work. Help!


$w . onReady ( function (){
//As someone logs in, depending on their code, the below function should direct somewhere else.
$w ( ‘#LoginButton’ ). onClick ( function (){
let name = $w ( ‘#LoginName’ ). value ;
let password = $w ( ‘#loginPassword’ ). value ;
//If the password equals one code, it should redirect to another page. This particular one will be the general schedule
if ( password == ‘1234’ )
location . href = ‘/schedule’ ;
}

}) 

})


import wixLocation from 'wix-location';

$w.onReady(function(){    
    $w('#LoginButton').onClick(()=>{
        let name = $w('#LoginName').value; console.log("Name: ", name);
        let password = $w('#loginPassword').value;

        if (password === '12345') {wixLocation.to("/schedule");}
        if (password === '54321') {wixLocation.to("/home");}
        if (password === '98765') {wixLocation.to("/main");}
    });
});

THANK YOU SO MUCH!!!