aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/store/actions/user.ts16
-rw-r--r--src/store/initialStates.ts1
-rw-r--r--src/store/reducers/userReducer.ts4
3 files changed, 21 insertions, 0 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 3ebd4190..0ed57fe6 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -11,6 +11,7 @@ import {getTokenOrLogout} from '../../utils';
import {
clearHeaderAndProfileImages,
profileCompletionStageUpdated,
+ setChatClientReady,
setIsOnboardedUser,
setNewNotificationReceived,
setNewVersionAvailable,
@@ -233,3 +234,18 @@ export const suggestedPeopleAnimatedTutorialFinished = (
console.log('Error while updating suggested people linked state: ', error);
}
};
+
+export const updateChatClientReady = (
+ chatClientReady: boolean,
+): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
+ dispatch,
+) => {
+ try {
+ dispatch({
+ type: setChatClientReady.type,
+ payload: {chatClientReady},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+};
diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts
index 02331eb6..546c57a9 100644
--- a/src/store/initialStates.ts
+++ b/src/store/initialStates.ts
@@ -41,6 +41,7 @@ export const EMPTY_PROFILE_PREVIEW_LIST = <ProfilePreviewType[]>[];
export const NO_USER_DATA = {
user: <UserType>NO_USER,
+ chatClientReady: <boolean>false,
profile: <ProfileInfoType>NO_PROFILE,
avatar: <string | undefined>undefined,
cover: <string | undefined>undefined,
diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts
index 9ff9ba01..0b958cac 100644
--- a/src/store/reducers/userReducer.ts
+++ b/src/store/reducers/userReducer.ts
@@ -75,6 +75,9 @@ const userDataSlice = createSlice({
state.avatar = '';
state.cover = '';
},
+ setChatClientReady: (state, action) => {
+ state.chatClientReady = action.payload.chatClientReady;
+ },
},
});
@@ -90,5 +93,6 @@ export const {
setReplyPosted,
setSuggestedPeopleImage,
clearHeaderAndProfileImages,
+ setChatClientReady,
} = userDataSlice.actions;
export const userDataReducer = userDataSlice.reducer;