Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _handleOnSubmit(values) {
- var self = this;
- let pt_data = JSON.stringify({
- firstName: values.name,
- email: values.email,
- password: values.password
- });
- axios({
- method: 'post',
- url: apiUrl.registerPersonalTrainer,
- data: pt_data,
- headers: {
- 'Content-type': 'application/json'
- }
- })
- .then(function (response) {
- self.setState({
- responseMessage: "Almost there... We just sent you a link for your email. Click that link to verify your account.",
- responseCode: response.status
- });
- })
- .catch(function (error) {
- if(error.response) {
- // The request was made and the server responded with a status code
- if(error.response.status === 302) {
- self.setState({
- responseMessage: "Email already in use! Try to sign up with different email account.",
- responseCode: error.response.status
- });
- }
- } else if (error.request) {
- // The request was made but no response was received
- console.log(error.request);
- self.setState({
- responseMessage: "We are sorry! Something went wrong. Try again later, please.",
- responseCode: error.request.status
- });
- } else {
- // Something happened in setting up the request that triggered an Error
- console.log('Error:', error.message);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement