aboutsummaryrefslogtreecommitdiff
path: root/src/services/UserProfileService.ts
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-04-21 13:25:23 -0400
committerGitHub <noreply@github.com>2021-04-21 13:25:23 -0400
commitcdc90fee17175bbf2015b40f18652f75799671a4 (patch)
tree01c920c8abbfff3bfcc605fc98cd96852f6ef824 /src/services/UserProfileService.ts
parentfa39bb545fefefeea1a941c6610e6f072dba6f61 (diff)
parente050709c3be4e9bae828caa6a01bfdab5f4bcfcf (diff)
Merge pull request #372 from IvanIFChen/tma378-viewed-your-profile
[TMA-378] Viewed your profile
Diffstat (limited to 'src/services/UserProfileService.ts')
-rw-r--r--src/services/UserProfileService.ts22
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;
+ }
+};