aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/services/UserProfileService.ts36
-rw-r--r--src/store/initialStates.ts1
-rw-r--r--src/types/types.ts1
3 files changed, 8 insertions, 30 deletions
diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts
index 828cdbf7..b499829f 100644
--- a/src/services/UserProfileService.ts
+++ b/src/services/UserProfileService.ts
@@ -7,12 +7,12 @@ import {
GET_TWITTER_POSTS_ENDPOINT,
HEADER_PHOTO_ENDPOINT,
PASSWORD_RESET_ENDPOINT,
- USER_PROFILE_ENDPOINT,
PROFILE_INFO_ENDPOINT,
PROFILE_PHOTO_ENDPOINT,
REGISTER_ENDPOINT,
SEND_OTP_ENDPOINT,
TAGG_CUSTOMER_SUPPORT,
+ USER_PROFILE_ENDPOINT,
VERIFY_OTP_ENDPOINT,
} from '../constants';
import {
@@ -26,7 +26,7 @@ import {
SUCCESS_PWD_RESET,
SUCCESS_VERIFICATION_CODE_SENT,
} from '../constants/strings';
-import {SocialAccountType, ProfileType} from '../types';
+import {ProfileInfoType, ProfileType, SocialAccountType} from '../types';
export const loadProfileInfo = async (token: string, userId: string) => {
try {
@@ -38,35 +38,11 @@ export const loadProfileInfo = async (token: string, userId: string) => {
});
const status = response.status;
if (status === 200) {
- const info = await response.json();
- let {
- name,
- biography,
- website,
- birthday,
- gender,
- snapchat,
- tiktok,
- university_class,
- profile_completion_stage,
- suggested_people_linked,
- friendship_status,
- friendship_requester_id,
- } = info;
- birthday = birthday && moment(birthday).format('YYYY-MM-DD');
+ const data: ProfileInfoType = await response.json();
+ const birthday = data.birthday;
return {
- name,
- biography,
- website,
- birthday,
- gender,
- snapchat,
- tiktok,
- university_class,
- profile_completion_stage,
- suggested_people_linked,
- friendship_status,
- friendship_requester_id,
+ ...data,
+ birthday: birthday && moment(birthday).format('YYYY-MM-DD'),
};
} else {
throw 'Unable to load profile data';
diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts
index 8ffdd559..47ab8f39 100644
--- a/src/store/initialStates.ts
+++ b/src/store/initialStates.ts
@@ -25,6 +25,7 @@ export const NO_PROFILE: ProfileInfoType = {
tiktok: '',
friendship_status: 'no_record',
friendship_requester_id: '',
+ is_private: true,
};
export const EMPTY_MOMENTS_LIST = <MomentType[]>[];
diff --git a/src/types/types.ts b/src/types/types.ts
index 692da8b4..3a4491a3 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -42,6 +42,7 @@ export interface ProfileInfoType {
tiktok: string;
friendship_status: FriendshipStatusType;
friendship_requester_id: string;
+ is_private: boolean;
}
export interface SocialAccountType {