@@ -144,10 +144,10 @@ export default {
144144 alwaysScrollToBottom: true ,
145145 messageStyling: true ,
146146 userIsTyping: false ,
147- placeholder: " Write something..." ,
147+ placeholder: ' Write something...' ,
148148 multipleChatsEnabled: true ,
149149 currentChatID: Object .keys (chatHistory)[0 ],
150- chatListTitle: " My chats" ,
150+ chatListTitle: ' My chats'
151151 }
152152 },
153153 created () {
@@ -171,7 +171,7 @@ export default {
171171 : ' '
172172 },
173173 onMessageWasSent (message , chatID ) {
174- const msg = Object .assign ({}, message, {id: Math .random (), read: (message .author === ' me ' )})
174+ const msg = Object .assign ({}, message, {id: Math .random (), read: (message .author === this . myId )})
175175 if (chatID !== undefined ) {
176176 this .chatMessageList (chatID).push (msg)
177177 } else {
@@ -241,7 +241,11 @@ export default {
241241 })
242242 },
243243 chatMessageList (chatID ) {
244- return this .chatHistory [chatID][" messages" ]
244+ const chat = this .chatHistory [chatID];
245+ if (chat === undefined ) {
246+ return [];
247+ }
248+ return chat[" messages" ];
245249 },
246250 },
247251 computed: {
@@ -254,10 +258,18 @@ export default {
254258 return this .chosenColor === ' dark' ? this .colors .messageList .bg : ' #fff'
255259 },
256260 messageList () {
257- return this .chatHistory [this .currentChatID ][" messages" ]
261+ const chat = this .chatHistory [this .currentChatID ];
262+ if (chat === undefined ) {
263+ return [];
264+ }
265+ return chat[" messages" ];
258266 },
259267 participants () {
260- return this .chatHistory [this .currentChatID ][" participants" ]
268+ const chat = this .chatHistory [this .currentChatID ];
269+ if (chat === undefined ) {
270+ return [];
271+ }
272+ return chat[" participants" ];
261273 },
262274 chatList () {
263275 var chats = []
0 commit comments