aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-02-11 17:14:44 -0500
committerIvan Chen <ivan@tagg.id>2021-02-11 17:14:44 -0500
commiteeac3efd296656a0ef0a1e5797fec7c9955c7a12 (patch)
tree2418b7e9ff40fbb6d51124644065ead0a6f24e8b
parentbcede9945a10ce7bf67aeeaf7f94e1a8984e7c0d (diff)
non-ui-blocking
-rw-r--r--src/screens/suggestedPeople/AnimatedTutorial.tsx2
-rw-r--r--src/store/actions/user.ts15
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);
}