diff options
| author | Ivan Chen <ivan@thetaggid.com> | 2021-02-23 17:02:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-23 17:02:53 -0500 |
| commit | 5864b997b68ae774a871ee9b43c0e548a2656cc6 (patch) | |
| tree | 5cbc4145437c0c498903a61b21bef0b4f523c1f8 /src/store | |
| parent | 21c03cb2a56e211909c08e8354441286bfc590ac (diff) | |
| parent | 3978bd82db12a4606ebb9a60c15352fb14ee0055 (diff) | |
Merge pull request #261 from IvanIFChen/hotfix-sp-people-state
[HOTFIX] Fixed SP state inconsistencies
Diffstat (limited to 'src/store')
| -rw-r--r-- | src/store/actions/user.ts | 16 | ||||
| -rw-r--r-- | src/store/initialStates.ts | 1 | ||||
| -rw-r--r-- | src/store/reducers/userReducer.ts | 5 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 3511dcf3..a9f9d945 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -13,6 +13,7 @@ import { setNewNotificationReceived, setNewVersionAvailable, setReplyPosted, + setSuggestedPeopleImage, setSuggestedPeopleLinked, socialEdited, userDetailsFetched, @@ -163,13 +164,16 @@ export const logout = (): ThunkAction< } }; -export const uploadedSuggestedPeoplePhoto = (): ThunkAction< - Promise<void>, - RootState, - unknown, - Action<string> -> => async (dispatch) => { +export const uploadedSuggestedPeoplePhoto = ( + imageUri: string, +): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async ( + dispatch, +) => { try { + await dispatch({ + type: setSuggestedPeopleImage.type, + payload: {suggestedPeopleImage: imageUri}, + }); dispatch({ type: setSuggestedPeopleLinked.type, payload: {suggested_people_linked: 1}, diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index 408de39e..4b61a2b1 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -47,6 +47,7 @@ export const NO_USER_DATA = { isOnboardedUser: false, newVersionAvailable: false, newNotificationReceived: false, + suggestedPeopleImage: '', replyPosted: <CommentThreadType | undefined>undefined, }; diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts index ea9294ec..587aa374 100644 --- a/src/store/reducers/userReducer.ts +++ b/src/store/reducers/userReducer.ts @@ -66,6 +66,10 @@ const userDataSlice = createSlice({ setNewVersionAvailable: (state, action) => { state.newVersionAvailable = action.payload.newVersionAvailable; }, + + setSuggestedPeopleImage: (state, action) => { + state.suggestedPeopleImage = action.payload.suggestedPeopleImage; + }, }, }); @@ -79,5 +83,6 @@ export const { setNewVersionAvailable, setNewNotificationReceived, setReplyPosted, + setSuggestedPeopleImage, } = userDataSlice.actions; export const userDataReducer = userDataSlice.reducer; |
