Help wix location not working

The following code is not working. But user is getting logged in. User should be able to navigate to contact page after Login successful. There is no issue with login, but user is not getting navigated to contact page. Any help much appreciated

export function loginButton_click(event) {

let email = $w( “#email” ).value;
let password = $w( “#password” ).value;
console.log(email);
wixUsers.login(email, password)
.then( () => {
wixlocation. to(‘/contact’);
console.log( “User is logged in” );
} )
. catch ( (err) => {
console.log(err);
} );
}

Hi,
Do you get any errors in the developer console?
Please share your editor’s URL so we can inspect.