File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
app/src/components/bottom Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -87,14 +87,16 @@ const Chatroom = (props): JSX.Element => {
87
87
} , [ newMessage ] ) ;
88
88
89
89
useEffect ( ( ) => {
90
- const messageContainer = document . getElementById ( 'message-container' ) ;
91
- const messageElement = document . createElement ( 'div' ) ;
92
- messageElement . innerText =
93
- userChange . status === 'JOIN'
94
- ? `${ userChange . nickName } joined the chat room`
95
- : `${ userChange . nickName } left the chat room` ;
96
- messageElement . style . color = 'yellow' ;
97
- messageContainer . append ( messageElement ) ;
90
+ if ( userChange . nickName !== '' && userChange . status !== '' ) {
91
+ const messageContainer = document . getElementById ( 'message-container' ) ;
92
+ const messageElement = document . createElement ( 'div' ) ;
93
+ messageElement . innerText =
94
+ userChange . status === 'JOIN'
95
+ ? `${ userChange . nickName } joined the chat room`
96
+ : `${ userChange . nickName } left the chat room` ;
97
+ messageElement . style . color = 'yellow' ;
98
+ messageContainer . append ( messageElement ) ;
99
+ }
98
100
} , [ userChange ] ) ;
99
101
100
102
return (
You can’t perform that action at this time.
0 commit comments