diff options
| author | Ivan Chen <ivan@thetaggid.com> | 2021-02-18 14:16:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-18 14:16:23 -0500 |
| commit | 2bb7b351a0e509beb9e6d87364471599af402db2 (patch) | |
| tree | fe23f63de28c4f472805f952a1422a72e7c3b8a0 /src/store/actions | |
| parent | 99db144ce20fd5f1502f668795ae7cafbc5b2eae (diff) | |
| parent | 04b998e6cca0d76c391b91403172c53f276db64a (diff) | |
Merge pull request #236 from IvanIFChen/tma626-people-tutorial
[TMA-626] Suggested People Tutorial (First 3 Screens)
Diffstat (limited to 'src/store/actions')
| -rw-r--r-- | src/store/actions/user.ts | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 990f9260..ef134dc5 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -1,9 +1,9 @@ import {Action, ThunkAction} from '@reduxjs/toolkit'; import { - editSPSwipeTutorial, loadAvatar, loadCover, loadProfileInfo, + sendSuggestedPeopleLinked, } from '../../services'; import {UserType} from '../../types/types'; import {getTokenOrLogout} from '../../utils'; @@ -13,11 +13,11 @@ import { setNewNotificationReceived, setNewVersionAvailable, setReplyPosted, + setSuggestedPeopleLinked, socialEdited, userDetailsFetched, userLoggedIn, } from '../reducers'; -import {spSwipeTutorialUpdated} from '../reducers/userReducer'; import {RootState} from '../rootReducer'; import {CommentThreadType} from './../../types/types'; @@ -163,9 +163,24 @@ export const logout = (): ThunkAction< } }; -export const updateSPSwipeTutorial = ( - user: UserType, - data: number, +export const uploadedSuggestedPeoplePhoto = (): ThunkAction< + Promise<void>, + RootState, + unknown, + Action<string> +> => async (dispatch) => { + try { + dispatch({ + type: setSuggestedPeopleLinked.type, + payload: {stage: 1}, + }); + } catch (error) { + console.log(error); + } +}; + +export const suggestedPeopleAnimatedTutorialFinished = ( + userId: string, ): ThunkAction< Promise<boolean | undefined>, RootState, @@ -173,12 +188,13 @@ export const updateSPSwipeTutorial = ( Action<string> > => async (dispatch) => { try { - // update store first, assume success + // update store first, assume request is successful dispatch({ - type: spSwipeTutorialUpdated.type, - payload: {sp_swipe_tutorial: data}, + type: setSuggestedPeopleLinked.type, + payload: {stage: 2}, }); - return await editSPSwipeTutorial(user); + // need to tell the server that the stage is now 2 + return await sendSuggestedPeopleLinked(userId, 2); } catch (error) { console.log('Error while updating suggested people linked state: ', error); } |
