Skip to content

Commit 6b44aba

Browse files
committed
refactor: reload window on logout
1 parent ad7de2b commit 6b44aba

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

apps/web/src/components/UserDropup/UserDropup.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ export const UserDropup = () => {
8383
</DropdownMenu.Item>
8484
<DropdownMenu.Item
8585
className="gap-2 hover:bg-slate-700 hover:text-slate-100 focus:bg-slate-700 focus:text-slate-100 focus:ring-0"
86-
onClick={() => {
87-
logout();
88-
void navigate({ reloadDocument: true, to: '/auth/login' });
89-
}}
86+
onClick={logout}
9087
>
9188
<LogOutIcon />
9289
{t({

apps/web/src/store/slices/auth.slice.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { jwtDecode } from 'jwt-decode';
55

66
import type { AuthSlice, SliceCreator } from '../types';
77

8-
export const createAuthSlice: SliceCreator<AuthSlice> = (set, get) => ({
8+
export const createAuthSlice: SliceCreator<AuthSlice> = (set) => ({
99
accessToken: null,
1010
changeGroup: (group) => {
1111
set({ currentGroup: group, currentSession: null });
@@ -22,12 +22,6 @@ export const createAuthSlice: SliceCreator<AuthSlice> = (set, get) => ({
2222
});
2323
},
2424
logout: () => {
25-
get().endSession();
26-
set((state) => {
27-
state.accessToken = null;
28-
state.currentGroup = null;
29-
state.currentUser = null;
30-
state.isDisclaimerAccepted = false;
31-
});
25+
window.location.reload();
3226
}
3327
});

0 commit comments

Comments
 (0)