From 9a26d4bbdf3787b11e8255774e2cf33ee5c8b47d Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 18 Sep 2021 17:23:11 -0400 Subject: [PATCH] Fix logout bug. Fixes #391 (#424) --- 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 9681285..ceb497f 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 0ab7ef6..2990fa2 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 ef6af05..a0268c6 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(); -- 2.44.1