diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-04-09 11:30:20 -0700 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-04-09 11:30:20 -0700 |
commit | 9fef149f9c2185c191d1b856d7939449ccc4f1d0 (patch) | |
tree | 77fd36601c857cdff5be7fb9cc69aa3d5c38a3c5 /src | |
parent | 0a09c73cabc656b85465102b8e266e1a0cc1fdf2 (diff) |
Added boolean for user connection status
Diffstat (limited to 'src')
-rw-r--r-- | src/store/actions/user.ts | 16 | ||||
-rw-r--r-- | src/store/initialStates.ts | 1 | ||||
-rw-r--r-- | src/store/reducers/userReducer.ts | 4 |
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; |