aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/UserProfileService.ts33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts
index d0610714..3bca66f3 100644
--- a/src/services/UserProfileService.ts
+++ b/src/services/UserProfileService.ts
@@ -2,7 +2,7 @@ import AsyncStorage from '@react-native-community/async-storage';
import moment from 'moment';
import {Alert} from 'react-native';
import RNFetchBlob from 'rn-fetch-blob';
-import {SocialAccountType} from '../types';
+import {SocialAccountType, UserType} from '../types';
import {
PROFILE_PHOTO_ENDPOINT,
HEADER_PHOTO_ENDPOINT,
@@ -15,6 +15,7 @@ import {
VERIFY_OTP_ENDPOINT,
SEND_OTP_ENDPOINT,
PROFILE_PHOTO_THUMBNAIL_ENDPOINT,
+ EDIT_PROFILE_ENDPOINT,
} from '../constants';
import {
ERROR_DOUBLE_CHECK_CONNECTION,
@@ -49,10 +50,15 @@ export const loadProfileInfo = async (token: string, userId: string) => {
tiktok,
university_class,
profile_completion_stage,
+ sp_swipe_tutorial,
friendship_status,
friendship_requester_id,
} = info;
birthday = birthday && moment(birthday).format('YYYY-MM-DD');
+ console.log(
+ 'Suggested People loaded from backend for logged in user: ',
+ sp_swipe_tutorial,
+ );
return {
name,
biography,
@@ -63,6 +69,7 @@ export const loadProfileInfo = async (token: string, userId: string) => {
tiktok,
university_class,
profile_completion_stage,
+ sp_swipe_tutorial,
friendship_status,
friendship_requester_id,
};
@@ -313,3 +320,27 @@ export const sendOtp = async (phone: string) => {
return false;
}
};
+
+export const editSPSwipeTutorial = async (user: UserType) => {
+ try {
+ const request = new FormData();
+ request.append('sp_swipe_tutorial', 1);
+ const endpoint = EDIT_PROFILE_ENDPOINT + `${user.userId}/`;
+ const token = await AsyncStorage.getItem('token');
+ let response = await fetch(endpoint, {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'multipart/form-data',
+ Authorization: 'Token ' + token,
+ },
+ body: request,
+ });
+ if (response.status === 200) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (error) {
+ console.log('Error updating animated tutorial close button press');
+ }
+};