aboutsummaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'src/store')
-rw-r--r--src/store/actions/user.ts32
-rw-r--r--src/store/initialStates.ts1
-rw-r--r--src/store/reducers/userReducer.ts5
3 files changed, 30 insertions, 8 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 5f49a103..589e6f0d 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -1,18 +1,19 @@
-import { CommentThreadType } from './../../types/types';
-import {RootState} from '../rootReducer';
-import {UserType} from '../../types/types';
-import {loadProfileInfo, loadAvatar, loadCover} from '../../services';
import {Action, ThunkAction} from '@reduxjs/toolkit';
+import {loadAvatar, loadCover, loadProfileInfo} from '../../services';
+import {UserType} from '../../types/types';
+import {getTokenOrLogout} from '../../utils';
import {
- userLoggedIn,
- userDetailsFetched,
- socialEdited,
profileCompletionStageUpdated,
setIsOnboardedUser,
setNewNotificationReceived,
+ setNewVersionAvailable,
setReplyPosted,
+ socialEdited,
+ userDetailsFetched,
+ userLoggedIn,
} from '../reducers';
-import {getTokenOrLogout} from '../../utils';
+import {RootState} from '../rootReducer';
+import {CommentThreadType} from './../../types/types';
/**
* Entry point to our store.
@@ -98,6 +99,21 @@ export const updateIsOnboardedUser = (
}
};
+export const updateNewVersionAvailable = (
+ newVersionAvailable: boolean,
+): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
+ dispatch,
+) => {
+ try {
+ dispatch({
+ type: setNewVersionAvailable.type,
+ payload: {newVersionAvailable},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+};
+
export const updateNewNotificationReceived = (
newNotificationReceived: boolean,
): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts
index 8d137a5d..6ca133e0 100644
--- a/src/store/initialStates.ts
+++ b/src/store/initialStates.ts
@@ -44,6 +44,7 @@ export const NO_USER_DATA = {
avatar: <string | null>'',
cover: <string | null>'',
isOnboardedUser: false,
+ newVersionAvailable: false,
newNotificationReceived: false,
replyPosted: <CommentThreadType | undefined>undefined,
};
diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts
index 1e575339..29ec38cc 100644
--- a/src/store/reducers/userReducer.ts
+++ b/src/store/reducers/userReducer.ts
@@ -57,6 +57,10 @@ const userDataSlice = createSlice({
setReplyPosted: (state, action) => {
state.replyPosted = action.payload.replyPosted;
},
+
+ setNewVersionAvailable: (state, action) => {
+ state.newVersionAvailable = action.payload.newVersionAvailable;
+ },
},
});
@@ -66,6 +70,7 @@ export const {
socialEdited,
profileCompletionStageUpdated,
setIsOnboardedUser,
+ setNewVersionAvailable,
setNewNotificationReceived,
setReplyPosted,
} = userDataSlice.actions;