Skip to content

Commit 4a9cf27

Browse files
dotansimhadarkbasic
authored andcommitted
Step 2.18: Implement removeChat method
1 parent 9acc010 commit 4a9cf27

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/pages/chats/chats.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,15 @@ export class ChatsPage {
6767
}
6868
]);
6969
}
70+
71+
removeChat(chat: Chat): void {
72+
this.chats = this.chats.map((chatsArray: Chat[]) => {
73+
const chatIndex = chatsArray.indexOf(chat);
74+
if (chatIndex !== -1) {
75+
chatsArray.splice(chatIndex, 1);
76+
}
77+
78+
return chatsArray;
79+
});
80+
}
7081
}

0 commit comments

Comments
 (0)