aboutsummaryrefslogtreecommitdiff
path: root/src/services/UserProfileService.ts
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-03-25 13:42:26 -0400
committerIvan Chen <ivan@tagg.id>2021-03-25 13:42:26 -0400
commite80e22569e9699b5bc0f2f7e3cc2f0e790e382a8 (patch)
tree527faeaa83de93f35e70c3d88daac9a62e505299 /src/services/UserProfileService.ts
parentcc1b5a0be911dc05386a5114e966b7ee4eb21441 (diff)
added is_private
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';