aboutsummaryrefslogtreecommitdiff
path: root/src/store/actions
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/actions')
-rw-r--r--src/store/actions/user.ts33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 5f49a103..98e1727b 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -1,7 +1,12 @@
-import { CommentThreadType } from './../../types/types';
+import {CommentThreadType} from './../../types/types';
import {RootState} from '../rootReducer';
import {UserType} from '../../types/types';
-import {loadProfileInfo, loadAvatar, loadCover} from '../../services';
+import {
+ loadProfileInfo,
+ loadAvatar,
+ loadCover,
+ editSPSwipeTutorial,
+} from '../../services';
import {Action, ThunkAction} from '@reduxjs/toolkit';
import {
userLoggedIn,
@@ -13,6 +18,7 @@ import {
setReplyPosted,
} from '../reducers';
import {getTokenOrLogout} from '../../utils';
+import {spSwipeTutorialUpdated} from '../reducers/userReducer';
/**
* Entry point to our store.
@@ -140,3 +146,26 @@ 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 {
+ const success = await editSPSwipeTutorial(user);
+ if (success) {
+ dispatch({
+ type: spSwipeTutorialUpdated.type,
+ payload: {sp_swipe_tutorial: data},
+ });
+ }
+ return success;
+ } catch (error) {
+ console.log('Error while updating suggested people linked state: ', error);
+ }
+};