diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-02-09 11:25:10 -0500 |
|---|---|---|
| committer | Ivan Chen <ivan@tagg.id> | 2021-02-09 11:25:10 -0500 |
| commit | a25ec0b95017a9b6e0c3392f8fe1ad4c604de520 (patch) | |
| tree | 370d6144466ffb82937adfb3a7737374656e67ed /src/store/actions | |
| parent | f28ef2d4ac61475d7bd9728634b80f7c0760ff58 (diff) | |
added newVersionAvailable to store, added logic to request newest version
Diffstat (limited to 'src/store/actions')
| -rw-r--r-- | src/store/actions/user.ts | 32 |
1 files changed, 24 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 ( |
