diff options
Diffstat (limited to 'src/screens/onboarding/RegistrationThree.tsx')
-rw-r--r-- | src/screens/onboarding/RegistrationThree.tsx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/screens/onboarding/RegistrationThree.tsx b/src/screens/onboarding/RegistrationThree.tsx index f8daaf71..5b8f52b3 100644 --- a/src/screens/onboarding/RegistrationThree.tsx +++ b/src/screens/onboarding/RegistrationThree.tsx @@ -28,6 +28,7 @@ import { Background, } from '../../components'; import {passwordRegex, usernameRegex, REGISTER_ENDPOINT} from '../../constants'; +import AsyncStorage from '@react-native-community/async-storage'; type RegistrationScreenThreeRouteProp = RouteProp< OnboardingStackParams, @@ -170,10 +171,15 @@ const RegistrationThree: React.FC<RegistrationThreeProps> = ({ let data = await registerResponse.json(); const userId: string = data.UserID; if (statusCode === 201) { - navigation.navigate('Checkpoint', { - userId: userId, - username: form.username, - }); + try { + await AsyncStorage.setItem('token', data.token); + navigation.navigate('Checkpoint', { + userId: userId, + username: form.username, + }); + } catch (err) { + console.log(err); + } } else if (statusCode === 409) { Alert.alert('Registration failed 😔', `${data}`); } else { |