How do I get rid of the default loginpage after logging out?

Hi everyone,

I’ve set up a custom login/logout bar (not the default accountNavBar) and it’s working just fine. By clicking on ‘Inloggen’ (It’s in Dutch) my custom login lightbox pops up and i’m logged in and redirected to my private member page. When logging out, I am logged out. But the only problem I’m having is that the default loginpage pops up as soon as I log out. I found a code that should redirect to my home page after logging out, but I can’t seem to get it to work. Could someone please tell me what is wrong about my code? The ‘textInloggen’ and ‘textMijnAccount’ are actually buttons.

import wixUsers from ‘wix-users’ ;
import wixData from ‘wix-data’ ;
import wixLocation from ‘wix-location’ ;
import wixWindow from ‘wix-window’

$w.onReady( () => {
$w( “#button5” ).onMouseIn((event) => {
$w( ‘#boxInloggen’ ).expand();
});

$w( "#boxInloggen" ).onMouseOut((event) => { 
     $w( '#boxInloggen' ).collapse(); 
}) 

if (wixUsers.currentUser.loggedIn) {
$w( “#textInloggen” ).label = “Uitloggen” ;
$w( “#textMijnAccount” ).expand();
}
else {
$w( “#textInloggen” ).label = “Inloggen” ;
$w( “#textMijnAccount” ).collapse();
}})

export function textInloggen_onClick() {
if (wixUsers.currentUser.loggedIn) {
wixUsers.logout();{

$w( "#textInloggen" ).onClick(logoutAndRedirect); 

function logoutAndRedirect(event) {
Promise.all( wixLocation.to( ‘/home’ ), wixUsers.logout()

  .then( () => { 
    $w( "#textInloggen" ).label =  "Inloggen" ; 
    $w( "#textMijnAccount" ).collapse() 
  }))}}} 

else {
wixWindow.openLightbox( “inloggen” )

    $w( "#boxInloggen" ).collapse()        
  . **catch** ( (err) => { 
    console.log(err); 
  } ); 

}
}

export function textMijnAccount_onClick() {
wixLocation.to(/account/account);
}

Having a very similar problem. After the user logs out default login/logout page pops up and the user is directed to the homepage only after they close that default login/logout light box. Why is it popping up? I already redirect the user to homepage. Any ideas?

P.S In my case the same thing goes for login as well. When the user logs in from my custom login page default wix login/logout lightbox pops up and the user needs to close it and cklick on my login button again to be logged in. Why?