diff options
-rw-r--r-- | src/screens/suggestedPeople/AnimatedTutorial.tsx | 2 | ||||
-rw-r--r-- | src/store/actions/user.ts | 15 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/screens/suggestedPeople/AnimatedTutorial.tsx b/src/screens/suggestedPeople/AnimatedTutorial.tsx index 9606eacb..8ebdaea6 100644 --- a/src/screens/suggestedPeople/AnimatedTutorial.tsx +++ b/src/screens/suggestedPeople/AnimatedTutorial.tsx @@ -19,7 +19,7 @@ const AnimatedTutorial: React.FC = () => { * Make call to edit profile endpoint with suggested people === 1 */ const data = 1; - await dispatch(updateSPSwipeTutorial(user, data)); + dispatch(updateSPSwipeTutorial(user, data)); navigation.pop(); }; return ( diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 9f1855ce..990f9260 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -1,14 +1,10 @@ -import {CommentThreadType} from './../../types/types'; -import {RootState} from '../rootReducer'; -import {UserType} from '../../types/types'; +import {Action, ThunkAction} from '@reduxjs/toolkit'; import { - loadProfileInfo, + editSPSwipeTutorial, loadAvatar, loadCover, - editSPSwipeTutorial, + loadProfileInfo, } from '../../services'; -import {Action, ThunkAction} from '@reduxjs/toolkit'; -import {loadAvatar, loadCover, loadProfileInfo} from '../../services'; import {UserType} from '../../types/types'; import {getTokenOrLogout} from '../../utils'; import { @@ -21,7 +17,6 @@ import { userDetailsFetched, userLoggedIn, } from '../reducers'; -import {getTokenOrLogout} from '../../utils'; import {spSwipeTutorialUpdated} from '../reducers/userReducer'; import {RootState} from '../rootReducer'; import {CommentThreadType} from './../../types/types'; @@ -178,12 +173,12 @@ export const updateSPSwipeTutorial = ( Action<string> > => async (dispatch) => { try { - const success = await editSPSwipeTutorial(user); + // update store first, assume success dispatch({ type: spSwipeTutorialUpdated.type, payload: {sp_swipe_tutorial: data}, }); - return success; + return await editSPSwipeTutorial(user); } catch (error) { console.log('Error while updating suggested people linked state: ', error); } |