aboutsummaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-03-16 13:11:06 -0400
committerIvan Chen <ivan@tagg.id>2021-03-17 18:38:08 -0400
commit593347d11dfa0d7c9d32cb79c2639041ce07d849 (patch)
treecc789fc7dddff3fcec2eb5ea221a1d0c3749a8bf /src/store
parent07a15098625786451270e30e61e2d6e78c02d4db (diff)
using s3 url instead of image passed from backend
Diffstat (limited to 'src/store')
-rw-r--r--src/store/actions/user.ts7
-rw-r--r--src/store/actions/userX.ts35
-rw-r--r--src/store/initialStates.ts4
3 files changed, 22 insertions, 24 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 4f1da47c..aae38d94 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -1,7 +1,6 @@
import {Action, ThunkAction} from '@reduxjs/toolkit';
import {
- loadAvatar,
- loadCover,
+ getProfilePic,
loadProfileInfo,
sendSuggestedPeopleLinked,
} from '../../services';
@@ -43,8 +42,8 @@ export const loadUserData = (
const token = await getTokenOrLogout(dispatch);
const [profile, avatar, cover] = await Promise.all([
loadProfileInfo(token, user.userId),
- loadAvatar(user.userId, false),
- loadCover(token, user.userId),
+ getProfilePic(token, user.userId, 'small'),
+ getProfilePic(token, user.userId, 'large'),
]);
dispatch({
type: userDetailsFetched.type,
diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts
index 07bea678..325c7568 100644
--- a/src/store/actions/userX.ts
+++ b/src/store/actions/userX.ts
@@ -1,28 +1,27 @@
-import {userXInStore} from './../../utils/';
-import {getTokenOrLogout, loadAllSocialsForUser} from './../../utils';
-import {UserType, ScreenType} from '../../types/types';
-import {RootState} from '../rootReducer';
import {Action, ThunkAction} from '@reduxjs/toolkit';
import {
- userXRequested,
+ getProfilePic,
+ loadFriends,
+ loadMomentCategories,
+ loadMoments,
+ loadProfileInfo,
+} from '../../services';
+import {ScreenType, UserType} from '../../types/types';
+import {
+ resetScreen,
userXAvatarFetched,
- userXFriendsFetched,
userXCoverFetched,
+ userXFriendsFetched,
+ userXMomentCategoriesFetched,
userXMomentsFetched,
userXProfileFetched,
+ userXRequested,
userXSocialsFetched,
userXUserFetched,
- userXMomentCategoriesFetched,
- resetScreen,
} from '../reducers';
-import {
- loadProfileInfo,
- loadAvatar,
- loadCover,
- loadFriends,
- loadMomentCategories,
- loadMoments,
-} from '../../services';
+import {RootState} from '../rootReducer';
+import {getTokenOrLogout, loadAllSocialsForUser} from './../../utils';
+import {userXInStore} from './../../utils/';
export const loadUserX = (
user: UserType,
@@ -50,13 +49,13 @@ export const loadUserX = (
payload: {screenType, userId, data},
}),
);
- loadAvatar(userId, false).then((data) =>
+ getProfilePic(token, userId, 'small').then((data) =>
dispatch({
type: userXAvatarFetched.type,
payload: {screenType, userId, data},
}),
);
- loadCover(token, userId).then((data) =>
+ getProfilePic(token, userId, 'large').then((data) =>
dispatch({
type: userXCoverFetched.type,
payload: {screenType, userId, data},
diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts
index b43e4a1d..275664cc 100644
--- a/src/store/initialStates.ts
+++ b/src/store/initialStates.ts
@@ -42,8 +42,8 @@ export const EMPTY_PROFILE_PREVIEW_LIST = <ProfilePreviewType[]>[];
export const NO_USER_DATA = {
user: <UserType>NO_USER,
profile: <ProfileType>NO_PROFILE,
- avatar: <string | null>'',
- cover: <string | null>'',
+ avatar: <string | undefined>'',
+ cover: <string | undefined>'',
isOnboardedUser: false,
newVersionAvailable: false,
newNotificationReceived: false,