diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-04-09 12:20:25 -0700 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-04-09 12:20:25 -0700 |
commit | b967bd77710bce7b92ae0863df52cce345abd4e4 (patch) | |
tree | e492b323712701f02339257beecc5279b050d764 /src/utils/users.ts | |
parent | d601b6dcf93dc1e326a9e79c5b19db6bcdaedbdf (diff) |
connecting user during login
Diffstat (limited to 'src/utils/users.ts')
-rw-r--r-- | src/utils/users.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/utils/users.ts b/src/utils/users.ts index 22c1c1f0..ec09198d 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -12,18 +12,17 @@ import { logout, } from '../store/actions'; import {NO_SOCIAL_ACCOUNTS} from '../store/initialStates'; -import {userLoggedIn} from '../store/reducers'; import {loadUserMomentCategories} from './../store/actions/momentCategories'; import {loadUserX} from './../store/actions/userX'; import {AppDispatch} from './../store/configureStore'; import {RootState} from './../store/rootReducer'; import { ProfilePreviewType, - CategoryPreviewType, ProfileInfoType, ScreenType, UserType, } from './../types/types'; +import {connectChatAccount} from './messages'; const loadData = async (dispatch: AppDispatch, user: UserType) => { await Promise.all([ @@ -44,7 +43,11 @@ const loadData = async (dispatch: AppDispatch, user: UserType) => { * @param dispatch This is the dispatch object from the redux store * @param user The user if at all any */ -export const userLogin = async (dispatch: AppDispatch, user: UserType) => { +export const userLogin = async ( + dispatch: AppDispatch, + user: UserType, + chatClient?, +) => { try { let localUser = {...user}; if (!user.userId) { @@ -64,6 +67,9 @@ export const userLogin = async (dispatch: AppDispatch, user: UserType) => { AsyncStorage.setItem('username', user.username), ]); } + if (chatClient) { + connectChatAccount(localUser.userId, chatClient, dispatch); + } await loadData(dispatch, localUser); } catch (error) { console.log(error); |