Commit 457de09b authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

benerin bug untuk email confirmation, di tambah logic di login

parent c297f36b
......@@ -36,12 +36,19 @@ class Login extends React.Component {
}
componentDidMount() {
this.handleCheck()
const { navigation } = this.props
console.log(this.props.BASE_URL)
CheckVersion(navigation)
this._getDeviceInfo()
}
handleCheck() {
if (this.props.pageEmailConfirmation === true) {
this.props.navigation.replace('Email Confirmation');
}
}
handleSettings() {
if (this.state.clickSettings == 3) {
this.props.navigation.navigate('Setting')
......@@ -170,7 +177,7 @@ class Login extends React.Component {
"build_number": Constants.manifest.extra.buildNumber
}
console.log(params)
Axios.post(this.props.BASE_URL+'crm/v2/auth/login', params).then(res => {
Axios.post(this.props.BASE_URL + 'crm/v2/auth/login', params).then(res => {
const navigation = this.props.navigation
......@@ -219,7 +226,7 @@ class Login extends React.Component {
isEmailverif: true
}
let pageProps = {
pageEmailConfirmation: true
pageEmailConfirmation: true,
}
let prosesProps = {
proses: ''
......@@ -271,7 +278,7 @@ class Login extends React.Component {
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>{i18n.t('email')}</Text>
<TextInput
caretHidden={this.state.caretHidden}
onFocus={() => this.setState({caretHidden: false})}
onFocus={() => this.setState({ caretHidden: false })}
style={{ height: 40, borderColor: 'gray', borderWidth: 1, padding: 10, borderRadius: 10, textAlign: 'center', fontFamily: 'Gotham-Black', color: 'white', fontSize: 13, fontWeight: 'bold' }}
onChangeText={(email) => this.setState({ email })}
autoCapitalize="none"
......@@ -284,7 +291,7 @@ class Login extends React.Component {
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>{i18n.t('password')}</Text>
<TextInput
caretHidden={this.state.caretHidden}
onFocus={() => this.setState({caretHidden: false})}
onFocus={() => this.setState({ caretHidden: false })}
style={{ height: 40, borderColor: 'gray', borderWidth: 1, padding: 5, borderRadius: 10, textAlign: 'center', fontFamily: 'Gotham-Black', color: 'white', fontSize: 13, fontWeight: 'bold' }}
onChangeText={password => this.setState({ password })}
value={this.state.password}
......@@ -311,11 +318,11 @@ class Login extends React.Component {
</View>
<View style={{ flex: 1, justifyContent: 'center', marginRight: 60, marginLeft: 60 }}>
<TouchableWithoutFeedback onPress={()=> this.handleSettings()}>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368', fontSize: 13, textAlign: 'center', marginBottom: 5 }}>
{i18n.t('policy')} <Text style={{ fontWeight: 'bold' }}>{i18n.t('privacy')}</Text>
</Text>
</TouchableWithoutFeedback>
<TouchableWithoutFeedback onPress={() => this.handleSettings()}>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368', fontSize: 13, textAlign: 'center', marginBottom: 5 }}>
{i18n.t('policy')} <Text style={{ fontWeight: 'bold' }}>{i18n.t('privacy')}</Text>
</Text>
</TouchableWithoutFeedback>
</View>
</View>
</ImageBackground>
......@@ -393,7 +400,8 @@ const mapDispatchToProps = (dispacth) => {
setPage: (pageProps) => dispacth({
type: ActionType.SET_PAGE,
data: {
pageEmailConfirmation: pageProps.pageEmailConfirmation
pageEmailConfirmation: pageProps.pageEmailConfirmation,
email_confirm: pageProps.email_confirm
}
}),
}
......@@ -410,66 +418,9 @@ const mapStateToProps = (state) => {
os_name: state.os_name,
app_version: state.app_version,
language: state.language,
BASE_URL: state.BASE_URL
BASE_URL: state.BASE_URL,
pageEmailConfirmation: state.pageEmailConfirmation
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Login);
// <Spinner
// visible={this.state.spinner}
// textContent={'Loading...'}
// textStyle={styles.spinnerTextStyle}
// />
// <View style={styles.form}>
// <View style={{ marginRight: 10, marginLeft: 10, }}>
// <Text style={{ top: 5 }}>Email</Text>
// </View>
// <View style={{ margin: 10 }}>
// <TextInput
// style={{ height: 40, borderColor: 'gray', borderWidth: 1, padding: 5 }}
// onChangeText={(email) => this.setState({ email })}
// autoCapitalize="none"
// value={this.state.email}
// keyboardType='email-address'
// />
// </View>
// <View style={{ marginRight: 10, marginLeft: 10 }}>
// <Text style={{ top: 5 }}>{i18n.t('password')}</Text>
// </View>
// <View style={{ margin: 10 }}>
// <TextInput
// style={{ height: 40, borderColor: 'gray', borderWidth: 1, padding: 5 }}
// onChangeText={password => this.setState({ password })}
// value={this.state.password}
// secureTextEntry={true}
// />
// </View>
// <View style={{ marginRight: 10, marginLeft: 10 }}>
// <Button
// title={i18n.t('login')}
// onPress={() => this.handleLoggin()}
// />
// </View>
// </View>
// <View style={styles.footer}>
// <View style={styles.container_register}>
// <View style={{ flex: 1 }}>
// <TouchableOpacity onPress={() => this.props.navigation.navigate('New Register')}>
// <Text style={{ fontSize: 20 }}>{i18n.t('register')}</Text>
// </TouchableOpacity>
// </View>
// <View style={{ flex: 1, }}>
// <TouchableOpacity onPress={() => this.props.navigation.navigate('Reset Password')}>
// <Text style={{ fontSize: 20, textAlign: 'right' }}>{i18n.t('forgotPassword')}</Text>
// </TouchableOpacity>
// </View>
// </View>
// </View>
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(Login);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment