aboutsummaryrefslogtreecommitdiff
path: root/src/screens/onboarding/ProfileOnboarding.tsx
diff options
context:
space:
mode:
authorShravya Ramesh <37447613+shravyaramesh@users.noreply.github.com>2020-10-07 23:06:32 -0700
committerGitHub <noreply@github.com>2020-10-08 02:06:32 -0400
commit45e435dbb4c43cb890eb360413784d0b2e331bc5 (patch)
treecaa1df04c7b5fcc70ba2c48fa780a4cf2d8e5e0d /src/screens/onboarding/ProfileOnboarding.tsx
parent0f332655d2b64700623f25912d2610517fb954b6 (diff)
[TMA 68] Frontend Token Security (#43)
* frontend tma-68 token security * removed: try catch while storing token to async, unnecessary console.log * login/registration exception handling and relocation * Modified promises, applied fetch restriction
Diffstat (limited to 'src/screens/onboarding/ProfileOnboarding.tsx')
-rw-r--r--src/screens/onboarding/ProfileOnboarding.tsx4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/screens/onboarding/ProfileOnboarding.tsx b/src/screens/onboarding/ProfileOnboarding.tsx
index 814cd82e..506d5f63 100644
--- a/src/screens/onboarding/ProfileOnboarding.tsx
+++ b/src/screens/onboarding/ProfileOnboarding.tsx
@@ -27,6 +27,7 @@ import {
genderRegex,
} from '../../constants';
import moment from 'moment';
+import AsyncStorage from '@react-native-community/async-storage';
type ProfileOnboardingScreenRouteProp = RouteProp<
OnboardingStackParams,
@@ -59,6 +60,7 @@ const ProfileOnboarding: React.FC<ProfileOnboardingProps> = ({route}) => {
isValidBio: true,
isValidGender: true,
attemptedSubmit: false,
+ token: '',
});
const [customGender, setCustomGender] = React.useState();
@@ -314,10 +316,12 @@ const ProfileOnboarding: React.FC<ProfileOnboardingProps> = ({route}) => {
const endpoint = EDIT_PROFILE_ENDPOINT + `${userId}/`;
try {
+ const token = await AsyncStorage.getItem('token');
let response = await fetch(endpoint, {
method: 'PATCH',
headers: {
'Content-Type': 'multipart/form-data',
+ Authorization: 'Token ' + token,
},
body: request,
});