aboutsummaryrefslogtreecommitdiff
path: root/src/services/SuggestedPeopleService.ts
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-02-20 12:24:33 -0500
committerIvan Chen <ivan@tagg.id>2021-02-20 12:24:33 -0500
commit82fc3c7ded1022a31cd532d469457d77f9214cc8 (patch)
tree08aeb9ce90be7ca69b56923bab6c34871b3a793a /src/services/SuggestedPeopleService.ts
parent9db520bf91b9c157ab2c9d2d3696348e031698d2 (diff)
parent4b8130932b943afe9fdf63c611f1897622ab795e (diff)
Merge branch 'master' into tma258-sp-pagination-2
# Conflicts: # src/constants/api.ts # src/screens/suggestedPeople/SuggestedPeopleScreen.tsx # src/services/SuggestedPeopleService.ts
Diffstat (limited to 'src/services/SuggestedPeopleService.ts')
-rw-r--r--src/services/SuggestedPeopleService.ts28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/services/SuggestedPeopleService.ts b/src/services/SuggestedPeopleService.ts
index 332e2f9a..34a31662 100644
--- a/src/services/SuggestedPeopleService.ts
+++ b/src/services/SuggestedPeopleService.ts
@@ -2,17 +2,17 @@ import AsyncStorage from '@react-native-community/async-storage';
import {
EDIT_PROFILE_ENDPOINT,
SP_UPDATE_PICTURE_ENDPOINT,
- SP_USERS_ENDPOINT,
+ SP_USERS_ENDPOINT
} from '../constants';
-import {SuggestedPeopleDataType} from '../types';
+import { SuggestedPeopleDataType } from '../types';
export const sendSuggestedPeopleLinked = async (
userId: string,
- stage: number,
+ suggested_people_linked: number,
) => {
try {
const request = new FormData();
- request.append('suggested_people_linked', stage);
+ request.append('suggested_people_linked', suggested_people_linked);
const endpoint = EDIT_PROFILE_ENDPOINT + `${userId}/`;
const token = await AsyncStorage.getItem('token');
let response = await fetch(endpoint, {
@@ -76,3 +76,23 @@ export const getSuggestedPeople = async (limit: number, offset: number) => {
return [];
}
};
+
+export const getSuggestedPeopleProfile = async (userId: string) => {
+ try {
+ const token = await AsyncStorage.getItem('token');
+ const response = await fetch(SP_USERS_ENDPOINT + userId + '/', {
+ method: 'GET',
+ headers: {
+ Authorization: 'Token ' + token,
+ },
+ });
+ if (response.status === 200) {
+ const data: SuggestedPeopleDataType = await response.json();
+ return data;
+ } else {
+ return undefined;
+ }
+ } catch (error) {
+ console.log('Error retrieving SP info');
+ return undefined;
+ }