group posts

This commit is contained in:
Виталий Лавшонок
2025-11-16 19:46:32 +03:00
parent b949837e13
commit 9cbfd88a23
9 changed files with 364 additions and 60 deletions

View File

@@ -215,7 +215,17 @@ export const deletePost = createAsyncThunk(
const postsSlice = createSlice({
name: 'posts',
initialState,
reducers: {},
reducers: {
setGroupFeedStatus: (
state,
action: PayloadAction<{ key: keyof PostsState; status: Status }>,
) => {
const { key, status } = action.payload;
if (state[key]) {
(state[key] as any).status = status;
}
},
},
extraReducers: (builder) => {
// fetchGroupPosts
builder.addCase(fetchGroupPosts.pending, (state) => {
@@ -333,4 +343,5 @@ const postsSlice = createSlice({
},
});
export const { setGroupFeedStatus } = postsSlice.actions;
export const groupFeedReducer = postsSlice.reducer;