fix: convos correctly delete

This commit is contained in:
Danny Avila 2023-03-07 13:53:23 -05:00
parent 17c01aa252
commit f2b092545f
8 changed files with 28 additions and 19 deletions

View file

@ -35,10 +35,14 @@ const currentSlice = createSlice({
state.convos = [...state.convos, ...newConvos].sort(
(a, b) => new Date(b.created) - new Date(a.created)
);
},
removeConvo: (state, action) => {
state.convos = state.convos.filter((convo) => convo.conversationId !== action.payload);
}
}
});
export const { setConversation, setConvos, setError, incrementPage } = currentSlice.actions;
export const { setConversation, setConvos, setError, incrementPage, removeConvo } =
currentSlice.actions;
export default currentSlice.reducer;