Created
September 1, 2017 17:52
-
-
Save jqed-xuereb/7a70a276aaeed4a7b239cff6d20fd36c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactNative from 'react-native'; | |
import AccountFields from './emailandpass' | |
import NameFields from './namefields' | |
import Axios from 'axios' | |
class Registration extends React.Component { | |
constructor(props){ | |
super(props); | |
this.state={ | |
email:'', | |
password:'', | |
first:'', | |
last:'', | |
dob:'' | |
} | |
} | |
componentWillReceiveProps(nextProps){ | |
console.log("nextProps",nextProps); | |
} | |
handlePress(event){ | |
var Url = "http://10.68.14.170:8080"; | |
// console.log("values in register handler",role); | |
var self = this; | |
//To be done:check for empty values before hitting submit | |
if(this.state.first.length>0 && this.state.last.length>0 && this.state.email.length>0 && this.state.password.length>0 && this.state.dob.length>0){ | |
var payload={ | |
"first": this.state.first, | |
"last":this.state.last, | |
"email":this.state.email, | |
"password":this.state.password, | |
"dob":this.state.dob | |
} | |
axios.post(Url+'/signup',payload) | |
.then(function (response) { | |
console.log(response.data); | |
if(response.data.code === 200){ | |
<Text> | |
'Tal-ostja' | |
</Text> | |
} | |
else{ | |
console.log("some error ocurred",response.data.code); | |
} | |
}) | |
.catch(function (error) { | |
console.log(error); | |
}); | |
} | |
else{ | |
alert("Input field value is missing"); | |
} | |
} | |
} | |
module.exports = Registration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment