From 5c6bedb572556586d34b99384dac1cad3a153402 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 1 Jun 2021 16:41:18 -0400 Subject: Refactor to use action instead of util function --- src/store/reducers/userReducer.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/store/reducers') diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts index 97bf845c..03fee112 100644 --- a/src/store/reducers/userReducer.ts +++ b/src/store/reducers/userReducer.ts @@ -1,4 +1,6 @@ import {createSlice} from '@reduxjs/toolkit'; +import {ActionSheetIOS} from 'react-native'; +import {Badge} from 'react-native-elements'; import {NO_USER_DATA} from '../initialStates'; /** @@ -46,6 +48,12 @@ const userDataSlice = createSlice({ state.profile.badges = action.payload.badges; }, + profileBadgeRemoved: (state, action) => { + state.profile.badges = state.profile.badges.filter( + (badge) => badge.name !== action.payload.badge, + ); + }, + profileCompletionStageUpdated: (state, action) => { state.profile.profile_completion_stage = action.payload.stage; }, @@ -95,6 +103,6 @@ export const { setSuggestedPeopleImage, clearHeaderAndProfileImages, profileBadgesUpdated, - // setChatClientReady, + profileBadgeRemoved, } = userDataSlice.actions; export const userDataReducer = userDataSlice.reducer; -- cgit v1.2.3-70-g09d2 From ba010611f8768ff523390141010899acf2d77b8b Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 1 Jun 2021 19:01:09 -0400 Subject: Lint --- src/store/reducers/userReducer.ts | 2 -- src/utils/common.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src/store/reducers') diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts index 03fee112..4692c5d3 100644 --- a/src/store/reducers/userReducer.ts +++ b/src/store/reducers/userReducer.ts @@ -1,6 +1,4 @@ import {createSlice} from '@reduxjs/toolkit'; -import {ActionSheetIOS} from 'react-native'; -import {Badge} from 'react-native-elements'; import {NO_USER_DATA} from '../initialStates'; /** diff --git a/src/utils/common.ts b/src/utils/common.ts index 6804558f..7e54eeaf 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -1,5 +1,4 @@ import AsyncStorage from '@react-native-community/async-storage'; -import {HeaderTitle} from '@react-navigation/stack'; import moment from 'moment'; import {Linking} from 'react-native'; import {getAll} from 'react-native-contacts'; @@ -13,6 +12,7 @@ import { NotificationType, UniversityBadge, UniversityBadgeDisplayType, + UniversityBadgeType, UniversityType, } from './../types/types'; -- cgit v1.2.3-70-g09d2