aboutsummaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorAshm Walia <ashmwalia@outlook.com>2021-01-15 19:04:07 -0800
committerAshm Walia <ashmwalia@outlook.com>2021-01-15 19:04:07 -0800
commit72aabf60d815cdecf59aaef86df57be6a557efd0 (patch)
tree4fac8f3fe8c44d0730fa3d7707500aa1a68afcd0 /src/store
parented91266981e1662b512baa1856d8c921a8718e68 (diff)
Done
Diffstat (limited to 'src/store')
-rw-r--r--src/store/actions/userX.ts15
-rw-r--r--src/store/reducers/userXReducer.ts2
2 files changed, 9 insertions, 8 deletions
diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts
index 6772837b..39d3f918 100644
--- a/src/store/actions/userX.ts
+++ b/src/store/actions/userX.ts
@@ -131,6 +131,7 @@ export const resetScreenType = (
export const updateUserXProfileAllScreens = (
userId: string,
+ state: RootState,
): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
dispatch,
) => {
@@ -142,13 +143,15 @@ export const updateUserXProfileAllScreens = (
];
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},
+ if (userXInStore(state, screenType, userId)) {
+ 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 42de806d..9f90d58d 100644
--- a/src/store/reducers/userXReducer.ts
+++ b/src/store/reducers/userXReducer.ts
@@ -64,8 +64,6 @@ 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) => {