diff --git a/04_lesson/src/features/posts/postsSlice.js b/04_lesson/src/features/posts/postsSlice.js index 354f55c..7dbe13b 100644 --- a/04_lesson/src/features/posts/postsSlice.js +++ b/04_lesson/src/features/posts/postsSlice.js @@ -106,6 +106,7 @@ const postsSlice = createSlice({ state.error = action.error.message }) .addCase(addNewPost.fulfilled, (state, action) => { + action.payload.id = state.posts[state.posts.length - 1].id + 1; action.payload.userId = Number(action.payload.userId) action.payload.date = new Date().toISOString(); action.payload.reactions = {