diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-03-29 20:17:59 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-29 20:17:59 -0400 |
| commit | a168fc7635c4d40365d095a476348e09ebbb1db9 (patch) | |
| tree | 5c0e68d4657b5aefc30b0c5eeda74a30d2d31462 /src/store | |
| parent | 3684e4d5fd25c4bbc87173036365c6ddfa25fead (diff) | |
| parent | 1bed2a96e83e06613c8255d1264b10d7afee6720 (diff) | |
Merge pull request #334 from IvanIFChen/tma740-header-pic-bug
[TMA-740] Head Pic Bug
Diffstat (limited to 'src/store')
| -rw-r--r-- | src/store/actions/user.ts | 13 | ||||
| -rw-r--r-- | src/store/reducers/userReducer.ts | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 374154da..e7d985ac 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -8,6 +8,7 @@ import { import {UserType} from '../../types/types'; import {getTokenOrLogout} from '../../utils'; import { + clearHeaderAndProfileImages, profileCompletionStageUpdated, setIsOnboardedUser, setNewNotificationReceived, @@ -55,6 +56,18 @@ export const loadUserData = ( } }; +export const resetHeaderAndProfileImage = (): ThunkAction< + Promise<void>, + RootState, + unknown, + Action<string> +> => async (dispatch) => { + await dispatch({ + type: clearHeaderAndProfileImages.type, + payload: {}, + }); +}; + /** * To update editable socials * @param social social to be updated diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts index 587aa374..9ff9ba01 100644 --- a/src/store/reducers/userReducer.ts +++ b/src/store/reducers/userReducer.ts @@ -70,6 +70,11 @@ const userDataSlice = createSlice({ setSuggestedPeopleImage: (state, action) => { state.suggestedPeopleImage = action.payload.suggestedPeopleImage; }, + + clearHeaderAndProfileImages: (state) => { + state.avatar = ''; + state.cover = ''; + }, }, }); @@ -84,5 +89,6 @@ export const { setNewNotificationReceived, setReplyPosted, setSuggestedPeopleImage, + clearHeaderAndProfileImages, } = userDataSlice.actions; export const userDataReducer = userDataSlice.reducer; |
