Fix logout bug. Fixes #391

This commit is contained in:
Dessalines 2021-09-18 17:12:46 -04:00
parent 8f132f67fa
commit de42608816
3 changed files with 6 additions and 4 deletions

View file

@ -429,7 +429,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
handleLogoutClick(i: Navbar) { handleLogoutClick(i: Navbar) {
i.setState({ showDropdown: false, expanded: false }); i.setState({ showDropdown: false, expanded: false });
UserService.Instance.logout(); UserService.Instance.logout();
i.context.router.history.push("/"); window.location.href = "/";
location.reload(); location.reload();
} }

View file

@ -1035,9 +1035,10 @@ export class Settings extends Component<any, SettingsState> {
i.setState(i.state); i.setState(i.state);
} }
handleLogoutClick(i: Settings) { handleLogoutClick(_i: Settings) {
UserService.Instance.logout(); UserService.Instance.logout();
i.context.router.history.push("/"); window.location.href = "/";
location.reload();
} }
handleDeleteAccount(i: Settings, event: any) { handleDeleteAccount(i: Settings, event: any) {
@ -1119,6 +1120,7 @@ export class Settings extends Component<any, SettingsState> {
}); });
UserService.Instance.logout(); UserService.Instance.logout();
window.location.href = "/"; window.location.href = "/";
location.reload();
} else if (op == UserOperation.BlockPerson) { } else if (op == UserOperation.BlockPerson) {
let data = wsJsonToRes<BlockPersonResponse>(msg).data; let data = wsJsonToRes<BlockPersonResponse>(msg).data;
this.setState({ personBlocks: updatePersonBlock(data) }); this.setState({ personBlocks: updatePersonBlock(data) });

View file

@ -37,7 +37,7 @@ export class UserService {
} }
public logout() { public logout() {
IsomorphicCookie.remove("jwt", { secure: false }); IsomorphicCookie.remove("jwt");
this.claims = undefined; this.claims = undefined;
this.myUserInfo = undefined; this.myUserInfo = undefined;
// setTheme(); // setTheme();