aboutsummaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'src/store')
-rw-r--r--src/store/actions/user.ts27
-rw-r--r--src/store/initialStates.ts1
-rw-r--r--src/store/reducers/userReducer.ts5
3 files changed, 30 insertions, 3 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 50f810e4..9f1855ce 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -8,17 +8,23 @@ import {
editSPSwipeTutorial,
} 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 {spSwipeTutorialUpdated} from '../reducers/userReducer';
+import {RootState} from '../rootReducer';
+import {CommentThreadType} from './../../types/types';
/**
* Entry point to our store.
@@ -104,6 +110,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 aa391713..93b1bc6e 100644
--- a/src/store/initialStates.ts
+++ b/src/store/initialStates.ts
@@ -45,6 +45,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 b353cc60..773977db 100644
--- a/src/store/reducers/userReducer.ts
+++ b/src/store/reducers/userReducer.ts
@@ -61,6 +61,10 @@ const userDataSlice = createSlice({
setReplyPosted: (state, action) => {
state.replyPosted = action.payload.replyPosted;
},
+
+ setNewVersionAvailable: (state, action) => {
+ state.newVersionAvailable = action.payload.newVersionAvailable;
+ },
},
});
@@ -70,6 +74,7 @@ export const {
socialEdited,
profileCompletionStageUpdated,
setIsOnboardedUser,
+ setNewVersionAvailable,
setNewNotificationReceived,
setReplyPosted,
spSwipeTutorialUpdated,