From d074b671293c8038935674ebfb990e844128cf07 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Tue, 13 Apr 2021 12:32:04 -0700 Subject: Stale token replaced --- src/screens/chat/ChatListScreen.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/screens') 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 = () => { }; 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 ( -- cgit v1.2.3-70-g09d2