simplify deleteChat logic
This commit is contained in:
parent
17a86d0538
commit
4ee5d0e5f6
|
@ -50,8 +50,6 @@
|
||||||
|
|
||||||
export const deleteChat = (chatId: number) => {
|
export const deleteChat = (chatId: number) => {
|
||||||
const chats = get(chatsStorage)
|
const chats = get(chatsStorage)
|
||||||
const chatIndex = chats.findIndex((chat) => chat.id === chatId)
|
chatsStorage.set(chats.filter((chat) => chat.id !== chatId))
|
||||||
chats.splice(chatIndex, 1)
|
|
||||||
chatsStorage.set(chats)
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue