aboutsummaryrefslogtreecommitdiff
path: root/src/services/UserProfileService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/services/UserProfileService.ts')
-rw-r--r--src/services/UserProfileService.ts36
1 files changed, 6 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';