Currently there is no API to refresh a page. It has been requested and it is in the works, but it will take a while. In the mean time, the only working solution I found is a double redirect:
Hi there I have a similar solution to Giri’s.
I have a “logout” button, which is linked to a page called Logout.
A user clicks the button and is taken to the Logout page, where I run the code below to log them out and redirect them where I want them to go.
import wixLocation from 'wix-location';
import wixUsers from 'wix-users';
$w.onReady(function () {
wixUsers.logout()
setTimeout(() => {
wixLocation.to("https://example.com/");
}, 1500); // set in milliseconds
});
I have some messaging on the page saying “You are now logged out and will be redirected to our homepage”, etc, but that’s not wholly necessary.