diff options
| author | Ashm Walia <ashmwalia@outlook.com> | 2021-01-15 16:20:29 -0800 |
|---|---|---|
| committer | Ashm Walia <ashmwalia@outlook.com> | 2021-01-15 16:20:29 -0800 |
| commit | ed91266981e1662b512baa1856d8c921a8718e68 (patch) | |
| tree | 10d61d494885f01427973fb430b3e2d1d47ce3c1 /src/store | |
| parent | df6595694c678657fec30d881fb1edcd39b62f17 (diff) | |
fixes
Diffstat (limited to 'src/store')
| -rw-r--r-- | src/store/actions/userFriends.ts | 1 | ||||
| -rw-r--r-- | src/store/actions/userX.ts | 32 | ||||
| -rw-r--r-- | src/store/reducers/userXReducer.ts | 2 |
3 files changed, 33 insertions, 2 deletions
diff --git a/src/store/actions/userFriends.ts b/src/store/actions/userFriends.ts index 010dc5ed..154ed20e 100644 --- a/src/store/actions/userFriends.ts +++ b/src/store/actions/userFriends.ts @@ -71,7 +71,6 @@ export const friendUnfriendUser = ( }); data = 'no_record'; } - // Update loggedInUser's friends list console.log('friendship_status data: ', data); dispatch({ type: userXFriendshipEdited.type, diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index 2f910052..6772837b 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -93,7 +93,11 @@ export const updateUserXFriends = ( dispatch, ) => { try { - const screens = <ScreenType[]>[ScreenType.Profile, ScreenType.Search]; + const screens = <ScreenType[]>[ + ScreenType.Profile, + ScreenType.Search, + ScreenType.Notifications, + ]; const token = await getTokenOrLogout(dispatch); screens.forEach((screenType) => { if (userXInStore(state, screenType, userId)) { @@ -124,3 +128,29 @@ export const resetScreenType = ( console.log(error); } }; + +export const updateUserXProfileAllScreens = ( + userId: string, +): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async ( + dispatch, +) => { + try { + const screens = <ScreenType[]>[ + ScreenType.Profile, + ScreenType.Search, + ScreenType.Notifications, + ]; + const token = await getTokenOrLogout(dispatch); + screens.forEach((screenType) => { + loadProfileInfo(token, userId).then((data) => { + console.log('DATA FETCHED: ', data); + dispatch({ + type: userXProfileFetched.type, + payload: {screenType, userId, data}, + }); + }); + }); + } catch (error) { + console.log(error); + } +}; diff --git a/src/store/reducers/userXReducer.ts b/src/store/reducers/userXReducer.ts index 9f90d58d..42de806d 100644 --- a/src/store/reducers/userXReducer.ts +++ b/src/store/reducers/userXReducer.ts @@ -64,6 +64,8 @@ const userXSlice = createSlice({ state[<ScreenType>action.payload.screenType][ action.payload.userId ].profile.friendship_status = action.payload.data; + + console.log('Inside state management friends', action.payload); }, resetScreen: (state, action) => { |
