We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fbcf522 commit 5165245Copy full SHA for 5165245
src/features/posts/postsSlice.ts
@@ -3,6 +3,8 @@ import { sub } from 'date-fns'
3
4
import type { RootState } from '@/app/store'
5
6
+import { userLoggedOut } from '@/features/auth/authSlice'
7
+
8
export interface Reactions {
9
thumbsUp: number
10
tada: number
@@ -88,6 +90,12 @@ const postsSlice = createSlice({
88
90
}
89
91
},
92
93
+ extraReducers: (builder) => {
94
+ builder.addCase(userLoggedOut, (state) => {
95
+ // Clear out the list of posts whenever the user logs out
96
+ return []
97
+ })
98
+ },
99
})
100
101
export const { postAdded, postUpdated, reactionAdded } = postsSlice.actions
0 commit comments