From: Dessalines Date: Sat, 18 Sep 2021 21:23:11 +0000 (-0400) Subject: Fix logout bug. Fixes #391 (#424) X-Git-Url: http://these/git/readmes/%7B%60%24%7BarchiveTodayUrl%7D/?a=commitdiff_plain;h=9a26d4bbdf3787b11e8255774e2cf33ee5c8b47d;p=lemmy-ui.git Fix logout bug. Fixes #391 (#424) --- 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();