From e050709c3be4e9bae828caa6a01bfdab5f4bcfcf Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 21 Apr 2021 12:23:37 -0400 Subject: updated to use the new endpoint --- src/services/UserProfileService.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/services') 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; + } +}; -- cgit v1.2.3-70-g09d2