- // NOTE: this local cleaning would logically happen when we're sure
- // that token is erased. But in the case a user clear the cookies,
- // it would lead to situations where he cannot ("locally") log out.
- // At worst, if token deletion fails the user can erase cookie manually.
- this.st.user.id = 0;
- this.st.user.name = "";
- this.st.user.email = "";
- this.st.user.notify = false;
- localStorage.removeItem("myid");
- localStorage.removeItem("myname");
- ajax("/logout", "GET"); //TODO: listen for errors?
- },
+ ajax(
+ "/logout",
+ "GET",
+ {
+ credentials: true,
+ success: () => {
+ this.logoutOk = true;
+ this.st.user.id = 0;
+ this.st.user.name = "";
+ this.st.user.email = "";
+ this.st.user.notify = false;
+ localStorage.removeItem("myid");
+ localStorage.removeItem("myname");
+ }
+ }
+ );
+ }