diff options
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 4da53c2e..2a5b76db 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -43,6 +43,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; |