aboutsummaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorIvan Chen <ivan@thetaggid.com>2021-01-20 15:52:37 -0500
committerGitHub <noreply@github.com>2021-01-20 15:52:37 -0500
commit7b45e8d238f392183f3c1742f22495a2f9c6fb7f (patch)
treebab6621bf916e9efa0ce863cf49b649bd6ba6548 /src/store
parenta64a0c53f108f8ea9c9ac0ba67c34ff82007271e (diff)
parent623bc69013c8fd173e49fb059eaba23c9219e0eb (diff)
Merge pull request #192 from ashmgarv/tma515-new-no-icon
[TMA - 515] New notifications icon and reordering of bottom navigation stack
Diffstat (limited to 'src/store')
-rw-r--r--src/store/actions/user.ts16
-rw-r--r--src/store/initialStates.ts1
-rw-r--r--src/store/reducers/userReducer.ts5
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;