aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShravya Ramesh <shravs1208@gmail.com>2021-04-27 17:51:55 -0700
committerShravya Ramesh <shravs1208@gmail.com>2021-04-27 17:51:55 -0700
commit20d2c580dd9576a3cfd95543300d7735157a3494 (patch)
tree9720312c9f9a738ae2318494941d5d97a304d4a2 /src
parent5cfced8a33a5f8eaa14e0549ee4b013bafa0833c (diff)
Added action to update badges
Diffstat (limited to 'src')
-rw-r--r--src/store/actions/user.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 3ebd4190..96e636f6 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -6,10 +6,11 @@ import {
loadProfileInfo,
sendSuggestedPeopleLinked,
} from '../../services';
-import {UserType} from '../../types/types';
+import {UniversityBadge, UserType} from '../../types/types';
import {getTokenOrLogout} from '../../utils';
import {
clearHeaderAndProfileImages,
+ profileBadgesUpdated,
profileCompletionStageUpdated,
setIsOnboardedUser,
setNewNotificationReceived,
@@ -90,6 +91,25 @@ export const updateSocial = (
}
};
+/**
+ * To update new user badges
+ * @param badges current selection of badges
+ */
+export const updateUserBadges = (
+ badges: UniversityBadge[],
+): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
+ dispatch,
+) => {
+ try {
+ dispatch({
+ type: profileBadgesUpdated.type,
+ payload: {badges},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+};
+
export const updateProfileCompletionStage = (
stage: number,
): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (