diff options
author | Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> | 2021-02-11 14:06:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 14:06:04 -0800 |
commit | bcede9945a10ce7bf67aeeaf7f94e1a8984e7c0d (patch) | |
tree | 229e130c90307507e68f17b016f81cf310822ccf /src/store | |
parent | da61f04d037d92fce7cf9852a3be79eb41158d5a (diff) | |
parent | 2561d20e17a697726d6b77accf79c9da2d1f6ef6 (diff) |
Merge branch 'master' into tma641-animation-tutorial
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/actions/user.ts | 27 | ||||
-rw-r--r-- | src/store/initialStates.ts | 1 | ||||
-rw-r--r-- | src/store/reducers/userReducer.ts | 5 |
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, |