Can I call a function when the user logs out, I know I can log out the user and then call a function, but is there any way like wixUsers.onLogin((user) =>
This would be very useful
use .then after the logout promise has been resolved…
import wixUsers from ‘wix-users’;
$w.onReady( function () {
wixUsers.logout()
.then(() => {
console.log("user has logged out")
//execute additional code you want after logout here
})
})
@mikemoynihan99 thank you for your response, I’m sure I tried this code earlier and it just logged out the user every time I tried to login? I can’t check it just now but I had it in my head that the code just logs the user out when it runs on the onReady?
you need to create an event, for example the user clicks a button an then the code executes.
@mikemoynihan99 Yeah this is the problem as I have been trying to keep the #accountNavBar so the login is accessed from the mobile menu, but you cant call any events to redirect. So I think the only solution is to build a custom mobile menu and code it…