wixLocation not working

Hi,
I am trying to user wixLocation in DB hook function.
I notice that if I add :import wixLocation from ‘wix-location’; to the js file the hook is not called and when I remove the import line everything work fine.
I am using other wix import (like wix-fetch) - it work great.

Hi,
Please share your code so we can inspect.

I am glad that I am not the only encountering the wixLocation.to problem. Mine don’t work either.

Hi @elroblehomecare ,
Please write your problem in a new post and share your code.

Hi Or, here is my latest post that I encountering the WixLocate.to issue.

Hi Or,

Here are my codes:
export function ProfileButton_click() {
//The log-in process is prompted
if (wixUsers.currentUser.loggedIn) {
//If the user is logged in and decides to log out
wixUsers.logout()
.then( (result) => {
// update buttons accordingly
wixLocation.to(/successfullogout); //This does not work
$w(‘#loginButton’).label = “Login/Register”;
$w(‘#button39’).show();
$w(‘#button10’).show();
$w(‘#box11’).show();
$w(‘#ProfileButton’).show();
$w(‘#profileButton’).hide();
$w(‘#CoffeeButton’).hide();
})
. catch ((err) => {
console.log(err);
});
}
// user is logged out
else {
wixLocation.to(/login);//This works
}
}

It may sound obvious, but have you made sure that yoursite.com/successfullogout is the correct URL?

@chris-derrell Trust me, I’ve tried different methods, including adding a button on another website that links to https://www.elroblehomecare.com/successfullogout, to verify the URL. https://www.elroblehomecare.com/successfullogout is not the only website that has issues with wixLocation.to