Then after promptLogin not work

Hello to all,

I have in my site in the code section concerning the site (no in page) this code.

I wanted to know why the instruction after the .then only works in part when the user logs and closes the lighrbox.

It does not make me redirect but everything else works. Where I’m wrong

Thank you

function redirectAccount() {
	return wixData.query("InfoUtenti")
	.eq('member_UserId', userId)
	.count()
	.then( (risultato) => {
	    if (risultato === 0) {
		wixLocation.to("/redirect-after-login");  			
	    }
	 });	
	
}

export function SignUpButtom_click() {
     if (wixUsers.currentUser.loggedIn) { 
	wixLocation.to("/login");	
     } else { 
     	wixUsers.promptLogin({"mode": "signup", "lang": "it"}) 
     	.then( (user) => {
     		userId = user.id;
     		$w("#LoginButtom").label = "Esci";
		$w("#SignUpButtom").label = "Account";
		redirectAccount();
     	});
     }
}

Hi RedDany,
Can you please share a link to your site and specify the name of the page so we can inspect ?
Roi.