I created a button that allows our members to click it and sign out of their account. I used the following code. But what more do I add that would redirect the member to a certain local page afterwards.
Another way to handle it is to catch the onLogout event in the masterPage.js file. This would have the advantage that it would also redirect the users when they logout via the menu option. Adding this code to the masterPage.js will do the trick.
import wixLocation from ‘wix-location’;
import {authentication} from ‘wix-members’;
$w.onReady(function () {
// This event handler is fired when the member logs out of the app.
// Redirect the member back to the home page
authentication.onLogout(() => {
console.log(‘Member logged out.’);
wixLocation.to(“/”);
});