From 5e9c0bcff40f0fa743f1c579c1ed135b3e1833b6 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 9 Apr 2021 15:48:50 -0700 Subject: fix --- src/components/profile/ProfileBody.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/components/profile/ProfileBody.tsx b/src/components/profile/ProfileBody.tsx index eebdb167..00532507 100644 --- a/src/components/profile/ProfileBody.tsx +++ b/src/components/profile/ProfileBody.tsx @@ -97,19 +97,19 @@ const ProfileBody: React.FC = ({ }; const onPressMessage = async () => { - let connected: boolean = !chatClient.user; - if (!connected) { - connected = await connectChatAccount(loggedInUserId, chatClient); - if (!connected) { - Alert.alert('Unable to connect chat'); - } - } else { + let connected: boolean = await connectChatAccount( + loggedInUserId, + chatClient, + ); + if (connected) { const channel = chatClient.channel('messaging', { members: [loggedInUserId, String(userXId)], }); channel.create(); setChannel(channel); navigation.navigate('Chat'); + } else { + Alert.alert('Something wrong with chat'); } }; -- cgit v1.2.3-70-g09d2