redirect after login/signup

export function Button_click(event) {
wixWindow.lightbox.close();
let options = {“mode”: “signup”, “lang”: “en”};
wixUsers.promptLogin(options)
.then( (user) => {
wixLocation.to(“/wantedPage”);
console.log(“redirect”);
} )
. catch ( (err) => {
let errorMsg = err; // “The user closed the login dialog”
} );
}

This code runs from a lightbox… and I must close the lightbox after users presses on registration.
But the promise of the registration which is goto wantedPage never runs… anything i can do? or workaround?