Added new post id increment to addNewPost payload

This commit is contained in:
gitdagray 2022-06-24 12:26:16 -05:00
parent 30d775883f
commit 81ce86f092

View File

@ -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 = {