From 5cfced8a33a5f8eaa14e0549ee4b013bafa0833c Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Tue, 27 Apr 2021 16:38:20 -0700 Subject: Added badges to store --- src/store/initialStates.ts | 1 + src/store/reducers/userReducer.ts | 5 +++++ src/types/types.ts | 1 + 3 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index 7fd3ac5a..e0f9d776 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -18,6 +18,7 @@ export const NO_PROFILE: ProfileInfoType = { birthday: undefined, university_class: 2021, university: undefined, + badges: [], //Default to an invalid value and ignore it gracefully while showing tutorials / popups. profile_completion_stage: -1, suggested_people_linked: -1, diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts index a8789c1d..97bf845c 100644 --- a/src/store/reducers/userReducer.ts +++ b/src/store/reducers/userReducer.ts @@ -42,6 +42,10 @@ const userDataSlice = createSlice({ } }, + profileBadgesUpdated: (state, action) => { + state.profile.badges = action.payload.badges; + }, + profileCompletionStageUpdated: (state, action) => { state.profile.profile_completion_stage = action.payload.stage; }, @@ -90,6 +94,7 @@ export const { setReplyPosted, setSuggestedPeopleImage, clearHeaderAndProfileImages, + profileBadgesUpdated, // setChatClientReady, } = userDataSlice.actions; export const userDataReducer = userDataSlice.reducer; diff --git a/src/types/types.ts b/src/types/types.ts index e7f651dc..18ddbfba 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -46,6 +46,7 @@ export interface ProfileInfoType { gender: string; university_class: number; university: UniversityType; + badges: UniversityBadge[]; profile_completion_stage: number; suggested_people_linked: number; birthday: Date | undefined; -- cgit v1.2.3-70-g09d2