Webix Jet User Plugins Logout Not Work

hi, please help logout not work (after click, page not redirect to login page)

{
    view: "icon", icon: "mdi mdi-logout",
    tooltip: "Logout",
     click: () => this.app.getService("user").logout()
}

session.js

function logout() {
    webix.storage.cookie.remove("appCookie");
    this.credentials = {};
    return new Promise((resolve, reject) => {
        resolve(this.credentials);
    });
}

Hello @nanangsunardi ,

I’m sorry if the documentation misled you. We will update the information there.

In fact, if to look at the source code of the logout() method, it’s seen that logout() resets the user’s data, but does not cause immediate redirecting to the login page. By default, the redirecting will work only on the first attempt to navigate to another page.
So, to redirect to the login page, you could:

  • call a redirect yourself: this.app.getService("user").logout().then(() => this.show("/login"));

  • Also, if to look again at the plugin’s source code, it’s seen that app:user:logout event is called. You may use this event to redirect to the login page too.

  • Finally, another option is to reserve some path (/logout by default) for automatic logout and redirection (here afterLogout redirects to “/login” by default). You could see it in one of our demos (node-express branch) .

thanks a lot. i will try