diff options
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/chat/ChatListScreen.tsx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/screens/chat/ChatListScreen.tsx b/src/screens/chat/ChatListScreen.tsx index 0cbc7592..d2cfcb5d 100644 --- a/src/screens/chat/ChatListScreen.tsx +++ b/src/screens/chat/ChatListScreen.tsx @@ -56,17 +56,19 @@ const ChatListScreen: React.FC<ChatListScreenProps> = () => { }; useEffect(() => { - connectChatAccount(loggedInUserId, chatClient) - .then((success) => { - if (!success) { + if (loggedInUserId) { + connectChatAccount(loggedInUserId, chatClient) + .then((success) => { + if (!success) { + Alert.alert('Something wrong with chat'); + } + }) + .catch((err) => { + console.log('Error connecting to chat: ', err); Alert.alert('Something wrong with chat'); - } - }) - .catch((err) => { - console.log('Error connecting to chat: ', err); - Alert.alert('Something wrong with chat'); - }); - }, []); + }); + } + }, [loggedInUserId]); return ( <View style={styles.background}> |
