From de426088165cdcf2c4cf188c7f21e839b46b59cc Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 18 Sep 2021 17:12:46 -0400 Subject: [PATCH] Fix logout bug. Fixes #391 --- src/shared/components/app/navbar.tsx | 2 +- src/shared/components/person/settings.tsx | 6 ++++-- src/shared/services/UserService.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/shared/components/app/navbar.tsx b/src/shared/components/app/navbar.tsx index 96812852..ceb497ff 100644 --- a/src/shared/components/app/navbar.tsx +++ b/src/shared/components/app/navbar.tsx @@ -429,7 +429,7 @@ export class Navbar extends Component { handleLogoutClick(i: Navbar) { i.setState({ showDropdown: false, expanded: false }); UserService.Instance.logout(); - i.context.router.history.push("/"); + window.location.href = "/"; location.reload(); } diff --git a/src/shared/components/person/settings.tsx b/src/shared/components/person/settings.tsx index 0ab7ef62..2990fa24 100644 --- a/src/shared/components/person/settings.tsx +++ b/src/shared/components/person/settings.tsx @@ -1035,9 +1035,10 @@ export class Settings extends Component { i.setState(i.state); } - handleLogoutClick(i: Settings) { + handleLogoutClick(_i: Settings) { UserService.Instance.logout(); - i.context.router.history.push("/"); + window.location.href = "/"; + location.reload(); } handleDeleteAccount(i: Settings, event: any) { @@ -1119,6 +1120,7 @@ export class Settings extends Component { }); UserService.Instance.logout(); window.location.href = "/"; + location.reload(); } else if (op == UserOperation.BlockPerson) { let data = wsJsonToRes(msg).data; this.setState({ personBlocks: updatePersonBlock(data) }); diff --git a/src/shared/services/UserService.ts b/src/shared/services/UserService.ts index ef6af05c..a0268c6d 100644 --- a/src/shared/services/UserService.ts +++ b/src/shared/services/UserService.ts @@ -37,7 +37,7 @@ export class UserService { } public logout() { - IsomorphicCookie.remove("jwt", { secure: false }); + IsomorphicCookie.remove("jwt"); this.claims = undefined; this.myUserInfo = undefined; // setTheme();