diff options
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/ExploreService.ts | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/services/ExploreService.ts b/src/services/ExploreService.ts index 43c2a96a..33b79b4a 100644 --- a/src/services/ExploreService.ts +++ b/src/services/ExploreService.ts @@ -1,7 +1,15 @@ import AsyncStorage from '@react-native-community/async-storage'; -import {ALL_USERS_ENDPOINT, DISCOVER_ENDPOINT} from '../constants'; +import { + ALL_USERS_ENDPOINT, + DISCOVER_ENDPOINT, + SEARCH_BUTTONS_ENDPOPINT, +} from '../constants'; import {EMPTY_PROFILE_PREVIEW_LIST} from '../store/initialStates'; -import {ExploreSectionType, ProfilePreviewType} from '../types'; +import { + ExploreSectionType, + ProfilePreviewType, + SearchCategoryType, +} from '../types'; export const getAllTaggUsers = async (token: string) => { try { @@ -80,3 +88,20 @@ export const getDiscoverUsers = async (id: number) => { return []; } }; + +export const getButtons = async () => { + const token = await AsyncStorage.getItem('token'); + const response = await fetch(SEARCH_BUTTONS_ENDPOPINT, { + method: 'GET', + headers: { + Authorization: 'Token ' + token, + }, + }); + + if (response.status !== 200) { + return []; + } + + const data: SearchCategoryType[] = await response.json(); + return data; +}; |
