diff options
author | Ivan Chen <ivan@thetaggid.com> | 2020-12-29 20:21:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 20:21:24 -0500 |
commit | bd2f89805d0bb1c2f1d08fe8d91099aa4f109d35 (patch) | |
tree | ac7219e034a0c4035096c6df8dbe6b92446b5111 /src/services/UserProfileService.ts | |
parent | ec478d4981c726856485b49b49ac33b0d9e6a903 (diff) |
[TMA-461] Notifications Screen (#151)
* renamed ProfileStack to MainStack, created initial notifications data type
* cleaned up code
* added notifications to redux
* finished sectioned list
* updated types to make more sense
* finished sectioned notifications by date
* updated notification type and tested mock backend integration
* finished read or unread logic
* minor changes
* another minor fix
* finished integration
* moved stuff
* added ability to navigate to user profile
Co-authored-by: Husam Salhab <47015061+hsalhab@users.noreply.github.com>
Diffstat (limited to 'src/services/UserProfileService.ts')
-rw-r--r-- | src/services/UserProfileService.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index c67174f9..8c88f0ab 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -1,3 +1,4 @@ +import {transformFromAstAsync} from '@babel/core'; import AsyncStorage from '@react-native-community/async-storage'; import moment from 'moment'; import {Alert} from 'react-native'; @@ -14,6 +15,7 @@ import { TAGG_CUSTOMER_SUPPORT, VERIFY_OTP_ENDPOINT, SEND_OTP_ENDPOINT, + PROFILE_PHOTO_THUMBNAIL_ENDPOINT, } from '../constants'; export const loadProfileInfo = async (token: string, userId: string) => { @@ -41,12 +43,16 @@ export const loadProfileInfo = async (token: string, userId: string) => { } }; -export const loadAvatar = async (token: string, userId: string) => { +export const loadAvatar = async (userId: string, thumbnail: boolean) => { try { + const token = await AsyncStorage.getItem('token'); + const url = thumbnail + ? PROFILE_PHOTO_THUMBNAIL_ENDPOINT + : PROFILE_PHOTO_ENDPOINT; const response = await RNFetchBlob.config({ fileCache: true, appendExt: 'jpg', - }).fetch('GET', PROFILE_PHOTO_ENDPOINT + `${userId}/`, { + }).fetch('GET', url + `${userId}/`, { Authorization: 'Token ' + token, }); const status = response.info().status; @@ -57,6 +63,7 @@ export const loadAvatar = async (token: string, userId: string) => { } } catch (error) { console.log(error); + return ''; } }; @@ -209,7 +216,7 @@ export const handlePasswordCodeVerification = async ( export const handlePasswordReset = async (value: string, password: string) => { try { const token = await AsyncStorage.getItem('token'); - const response = await fetch(PASSWORD_RESET_ENDPOINT + `reset/`, { + const response = await fetch(PASSWORD_RESET_ENDPOINT + 'reset/', { method: 'POST', headers: { Authorization: 'Token ' + token, |