diff options
Diffstat (limited to 'src/services')
-rw-r--r-- | src/services/CommonService.ts | 2 | ||||
-rw-r--r-- | src/services/ExploreService.ts | 1 | ||||
-rw-r--r-- | src/services/SearchService.ts | 22 | ||||
-rw-r--r-- | src/services/UserProfileService.ts | 45 | ||||
-rw-r--r-- | src/services/index.ts | 1 |
5 files changed, 69 insertions, 2 deletions
diff --git a/src/services/CommonService.ts b/src/services/CommonService.ts index 9fa7417f..5bc1174d 100644 --- a/src/services/CommonService.ts +++ b/src/services/CommonService.ts @@ -22,7 +22,7 @@ export const loadImageFromURL = async (url: string) => { } }; -export const getLiveVersion = async () => { +export const getCurrentLiveVersions = async () => { try { const response = await fetch(VERSION_ENDPOINT, {method: 'GET'}); return response.status === 200 ? await response.json() : undefined; diff --git a/src/services/ExploreService.ts b/src/services/ExploreService.ts index 980258be..dc58bdd0 100644 --- a/src/services/ExploreService.ts +++ b/src/services/ExploreService.ts @@ -50,6 +50,7 @@ export const getAllExploreSections = async () => { "Brown '21": data.categories.brown_21, "Brown '22": data.categories.brown_22, "Brown '23": data.categories.brown_23, + "Brown '24": data.categories.brown_24, }; return exploreSections; diff --git a/src/services/SearchService.ts b/src/services/SearchService.ts new file mode 100644 index 00000000..7b97f9a7 --- /dev/null +++ b/src/services/SearchService.ts @@ -0,0 +1,22 @@ +import AsyncStorage from '@react-native-community/async-storage'; + +export const loadSearchResults = async (url: string) => { + try { + const token = await AsyncStorage.getItem('token'); + const response = await fetch(url, { + method: 'GET', + headers: { + Authorization: 'Token ' + token, + }, + }); + const {status} = response; + if (status === 200) { + const searchResults = await response.json(); + return searchResults; + } + } catch (error) { + console.log(error); + throw error; + } + return {}; +}; diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index bfc4933f..dd77db9f 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -11,6 +11,7 @@ import { PROFILE_INFO_ENDPOINT, PROFILE_PHOTO_ENDPOINT, PROFILE_PHOTO_THUMBNAIL_ENDPOINT, + REGISTER_ENDPOINT, SEND_OTP_ENDPOINT, TAGG_CUSTOMER_SUPPORT, VERIFY_OTP_ENDPOINT, @@ -292,7 +293,6 @@ export const verifyOtp = async (phone: string, otp: string) => { export const sendOtp = async (phone: string) => { try { - console.log(phone); let response = await fetch(SEND_OTP_ENDPOINT, { method: 'POST', body: JSON.stringify({ @@ -313,3 +313,46 @@ export const sendOtp = async (phone: string) => { return false; } }; + +export const sendOtpStatusCode = async (phone: string) => { + try { + let response = await fetch(SEND_OTP_ENDPOINT, { + method: 'POST', + body: JSON.stringify({ + phone_number: '+1' + phone, + }), + }); + + return response.status; + } catch (error) { + console.log(error); + return undefined; + } +}; + +export const sendRegister = async ( + firstName: string, + lastName: string, + phone: string, + email: string, + username: string, + password: string, +) => { + try { + const response = await fetch(REGISTER_ENDPOINT, { + method: 'POST', + body: JSON.stringify({ + first_name: firstName, + last_name: lastName, + email: email, + phone_number: phone, + username: username, + password: password, + }), + }); + return response; + } catch (error) { + console.log(error); + return undefined; + } +}; diff --git a/src/services/index.ts b/src/services/index.ts index ef71233a..28e03e0e 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -12,3 +12,4 @@ export * from './WaitlistUserService'; export * from './CommonService'; export * from './CommentService'; export * from './SuggestedPeopleService'; +export * from './SearchService'; |