aboutsummaryrefslogtreecommitdiff
path: root/src/utils/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/users.ts')
-rw-r--r--src/utils/users.ts12
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);