diff options
| author | Ivan Chen <ivan@thetaggid.com> | 2021-02-11 17:27:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-11 17:27:30 -0500 |
| commit | d494b27509066f4d1b61078f1fe6457f20d5f449 (patch) | |
| tree | 2418b7e9ff40fbb6d51124644065ead0a6f24e8b /src/store/actions | |
| parent | 2561d20e17a697726d6b77accf79c9da2d1f6ef6 (diff) | |
| parent | eeac3efd296656a0ef0a1e5797fec7c9955c7a12 (diff) | |
Merge pull request #239 from shravyaramesh/tma641-animation-tutorial
[TMA-641] Suggested People: Swipe Up Animation Tutorial
Diffstat (limited to 'src/store/actions')
| -rw-r--r-- | src/store/actions/user.ts | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 589e6f0d..990f9260 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -1,5 +1,10 @@ import {Action, ThunkAction} from '@reduxjs/toolkit'; -import {loadAvatar, loadCover, loadProfileInfo} from '../../services'; +import { + editSPSwipeTutorial, + loadAvatar, + loadCover, + loadProfileInfo, +} from '../../services'; import {UserType} from '../../types/types'; import {getTokenOrLogout} from '../../utils'; import { @@ -12,6 +17,7 @@ import { userDetailsFetched, userLoggedIn, } from '../reducers'; +import {spSwipeTutorialUpdated} from '../reducers/userReducer'; import {RootState} from '../rootReducer'; import {CommentThreadType} from './../../types/types'; @@ -156,3 +162,24 @@ export const logout = (): ThunkAction< console.log(error); } }; + +export const updateSPSwipeTutorial = ( + user: UserType, + data: number, +): ThunkAction< + Promise<boolean | undefined>, + RootState, + unknown, + Action<string> +> => async (dispatch) => { + try { + // update store first, assume success + dispatch({ + type: spSwipeTutorialUpdated.type, + payload: {sp_swipe_tutorial: data}, + }); + return await editSPSwipeTutorial(user); + } catch (error) { + console.log('Error while updating suggested people linked state: ', error); + } +}; |
