diff options
| author | Ashm Walia <ashmwalia@outlook.com> | 2021-01-19 11:36:56 -0800 |
|---|---|---|
| committer | Ashm Walia <ashmwalia@outlook.com> | 2021-01-19 11:36:56 -0800 |
| commit | c510ba308738fc88edb11772fe9db6ec4537427f (patch) | |
| tree | 86ca27286d50c35ec9a4b6362c8b42408ac85160 /src/store | |
| parent | bb885ff561e44e23f9fb27ba8aa18f4dce8c690e (diff) | |
Done
Diffstat (limited to 'src/store')
| -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 | 5 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 8550f3bd..0b1ea789 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -8,6 +8,7 @@ import { socialEdited, profileCompletionStageUpdated, setIsOnboardedUser, + setNewNotificationReceived, } from '../reducers'; import {getTokenOrLogout} from '../../utils'; @@ -95,6 +96,21 @@ export const updateIsOnboardedUser = ( } }; +export const updateNewNotificationReceived = ( + newNotificationReceived: boolean, +): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async ( + dispatch, +) => { + try { + dispatch({ + type: setNewNotificationReceived.type, + payload: {newNotificationReceived}, + }); + } catch (error) { + console.log(error); + } +}; + export const logout = (): ThunkAction< Promise<void>, RootState, diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index 08dc7077..c7d2d704 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -41,6 +41,7 @@ export const NO_USER_DATA = { avatar: <string | null>'', cover: <string | null>'', isOnboardedUser: false, + newNotificationReceived: false, }; export const NO_FRIENDS_DATA = { diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts index 2e71e38e..ce497677 100644 --- a/src/store/reducers/userReducer.ts +++ b/src/store/reducers/userReducer.ts @@ -49,6 +49,10 @@ const userDataSlice = createSlice({ setIsOnboardedUser: (state, action) => { state.isOnboardedUser = action.payload.isOnboardedUser; }, + + setNewNotificationReceived: (state, action) => { + state.newNotificationReceived = action.payload.newNotificationReceived; + }, }, }); @@ -58,5 +62,6 @@ export const { socialEdited, profileCompletionStageUpdated, setIsOnboardedUser, + setNewNotificationReceived, } = userDataSlice.actions; export const userDataReducer = userDataSlice.reducer; |
