From eeac3efd296656a0ef0a1e5797fec7c9955c7a12 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 11 Feb 2021 17:14:44 -0500 Subject: non-ui-blocking --- src/store/actions/user.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/store') 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 > => 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); } -- cgit v1.2.3-70-g09d2