Type Chat message Store
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
parent
1efcbb4529
commit
385ea1360e
2 changed files with 10 additions and 5 deletions
|
@ -84,7 +84,12 @@ function createChatMessagesStore() {
|
|||
addExternalMessage(authorId: number, text: string) {
|
||||
update((list) => {
|
||||
const lastMessage = list[list.length - 1];
|
||||
if (lastMessage && lastMessage.type === ChatMessageTypes.text && lastMessage.text && lastMessage?.author?.userId === authorId) {
|
||||
if (
|
||||
lastMessage &&
|
||||
lastMessage.type === ChatMessageTypes.text &&
|
||||
lastMessage.text &&
|
||||
lastMessage?.author?.userId === authorId
|
||||
) {
|
||||
lastMessage.text.push(text);
|
||||
} else {
|
||||
list.push({
|
||||
|
@ -116,4 +121,4 @@ function createChatSubMenuVisibilityStore() {
|
|||
};
|
||||
}
|
||||
|
||||
export const chatSubMenuVisbilityStore = createChatSubMenuVisibilityStore();
|
||||
export const chatSubMenuVisibilityStore = createChatSubMenuVisibilityStore();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue