diff --git a/aws-exports.js b/aws-exports.js index 4ea058b..c1b545b 100644 --- a/aws-exports.js +++ b/aws-exports.js @@ -1,7 +1,7 @@ const config = { - identityPoolId: 'us-east-2:2d550536-b16e-4998-83d9-341ed50e2a9d', + identityPoolId: 'us-east-2:aec9ba3d-3e3f-4e1f-9090-a60fd769e895', region: 'us-east-2', - userPoolId: 'us-east-2_TPSepruyZ', - userPoolWebClientId: '3c311eos0ca1ha9tkp8fleui85' + userPoolId: 'us-east-2_fzKjLKOW3', + userPoolWebClientId: '3sider0qtjrjfdudk3g5vor6sk' } export default config \ No newline at end of file diff --git a/src/actions.js b/src/actions.js index 1391b4f..c610400 100644 --- a/src/actions.js +++ b/src/actions.js @@ -39,23 +39,18 @@ function signUpFailure(err) { } } -export function createUser(username, password, email, phone_number) { +export function createUser(username, password) { return (dispatch) => { dispatch(signUp()) - let phone - const firstTwoDigits = phone_number.substring(0, 2) + const firstTwoDigits = username.substring(0, 2) if (firstTwoDigits === '+1') { - phone = phone_number + username = username } else { - phone = '+1' + phone_number + username = '+1' + username } Auth.signUp({ username, password, - attributes: { - email, - phone_number: phone - } }) .then(data => { console.log('data from signUp: ', data) @@ -64,6 +59,9 @@ export function createUser(username, password, email, phone_number) { }) .catch(err => { console.log('error signing up: ', err) + if ("1" == err.message.substring(0, 1)) { + err.message = "Password must have length greater than or equal to 6" + } dispatch(signUpFailure(err)) }); } @@ -160,15 +158,11 @@ function confirmLoginFailure() { } export function confirmUserSignUp(username, authCode) { - return (dispatch) => { - dispatch(confirmSignUp()) + return (dispatch, getState) => { Auth.confirmSignUp(username, authCode) .then(data => { console.log('data from confirmSignUp: ', data) dispatch(confirmSignUpSuccess()) - setTimeout(() => { - Alert.alert('Successfully Signed Up!', 'Please Sign') - }, 0) }) .catch(err => { console.log('error signing up: ', err) diff --git a/src/auth/SignIn.js b/src/auth/SignIn.js index 09104ef..1d1874f 100644 --- a/src/auth/SignIn.js +++ b/src/auth/SignIn.js @@ -44,7 +44,6 @@ class SignIn extends Component<{}> { } render() { - const { fontsLoaded } = this.state const { auth: { signInErrorMessage, isAuthenticating, @@ -61,14 +60,14 @@ class SignIn extends Component<{}> { /> - Welcome back, + Sign In - Let's eat together. + Let's help you order food. { } signUp() { - const { username, password, email, phone_number } = this.state - this.props.dispatchCreateUser(username, password, email, phone_number) + const { username, password } = this.state + this.props.dispatchCreateUser(username, password) } confirm() { @@ -61,6 +59,10 @@ class SignUp extends Component<{}> { signUpError, signUpErrorMessage }} = this.props + // let user = this.props.auth.user + // if ( Object.keys(user).length === 0 && user.constructor === Object) { + // console.log('empty'); + // } return ( @@ -71,23 +73,17 @@ class SignUp extends Component<{}> { /> - Welcome, + Sign Up - Let's make an account for you. + Let's get you started. - { type='password' onChangeText={this.onChangeText} /> - +