diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-03-29 18:52:40 -0400 |
|---|---|---|
| committer | Ivan Chen <ivan@tagg.id> | 2021-03-29 18:52:40 -0400 |
| commit | 1bed2a96e83e06613c8255d1264b10d7afee6720 (patch) | |
| tree | 7cc98222fcc73f79125dba08bb1116dc211c8b0e /src/store | |
| parent | af2136ff699ac4556732da4e262add82c15b2b5c (diff) | |
reset url in state after editing profile
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 46f96d9a..10132dd9 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -7,6 +7,7 @@ import { import {UserType} from '../../types/types'; import {getTokenOrLogout} from '../../utils'; import { + clearHeaderAndProfileImages, profileCompletionStageUpdated, setIsOnboardedUser, setNewNotificationReceived, @@ -54,6 +55,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; |
