diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-21 12:23:37 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-04-21 12:23:37 -0400 |
commit | e050709c3be4e9bae828caa6a01bfdab5f4bcfcf (patch) | |
tree | 01c920c8abbfff3bfcc605fc98cd96852f6ef824 /src/services/UserProfileService.ts | |
parent | 419681ad0d832808caec5252fb65aa154b0e4ae2 (diff) |
updated to use the new endpoint
Diffstat (limited to 'src/services/UserProfileService.ts')
-rw-r--r-- | src/services/UserProfileService.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index 1ce1d0b5..a2237c94 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -16,6 +16,7 @@ import { SEND_OTP_ENDPOINT, TAGG_CUSTOMER_SUPPORT, USER_PROFILE_ENDPOINT, + USER_PROFILE_VISITED_ENDPOINT, VERIFY_OTP_ENDPOINT, } from '../constants'; import { @@ -412,3 +413,24 @@ export const patchEditProfile = async (form: FormData, userId: string) => { throw ERROR_DOUBLE_CHECK_CONNECTION; } }; + +export const visitedUserProfile = async (userId: string) => { + try { + const token = await AsyncStorage.getItem('token'); + const form = new FormData(); + form.append('user_id', userId); + const response = await fetch(USER_PROFILE_VISITED_ENDPOINT, { + method: 'POST', + headers: { + 'Content-Type': 'multipart/form-data', + Authorization: 'Token ' + token, + }, + body: form, + }); + if (response.status !== 200) { + console.error('Failed to submit a profile visit'); + } + } catch (error) { + return undefined; + } +}; |