From 81b7f649ed44875aaf08d7121ba12ee9e89e798f Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Wed, 7 Oct 2015 10:07:08 -0700
Subject: GIT-960 show error when you cannot create a team

---
 web/react/components/team_signup_with_email.jsx | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

(limited to 'web/react/components/team_signup_with_email.jsx')

diff --git a/web/react/components/team_signup_with_email.jsx b/web/react/components/team_signup_with_email.jsx
index 4fb1c0d01..ba9d4c3e0 100644
--- a/web/react/components/team_signup_with_email.jsx
+++ b/web/react/components/team_signup_with_email.jsx
@@ -14,8 +14,8 @@ export default class EmailSignUpPage extends React.Component {
     }
     handleSubmit(e) {
         e.preventDefault();
-        let team = {};
-        let state = {serverError: ''};
+        var team = {};
+        var state = {serverError: ''};
 
         team.email = React.findDOMNode(this.refs.email).value.trim().toLowerCase();
         if (!team.email || !Utils.isEmail(team.email)) {
@@ -31,20 +31,25 @@ export default class EmailSignUpPage extends React.Component {
         }
 
         Client.signupTeam(team.email,
-            function success(data) {
+            (data) => {
                 if (data.follow_link) {
                     window.location.href = data.follow_link;
                 } else {
                     window.location.href = `/signup_team_confirm/?email=${encodeURIComponent(team.email)}`;
                 }
             },
-            function fail(err) {
+            (err) => {
                 state.serverError = err.message;
                 this.setState(state);
-            }.bind(this)
+            }
         );
     }
     render() {
+        var serverError = null;
+        if (this.state.serverError) {
+            serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
+        }
+
         return (
             <form
                 role='form'
@@ -65,8 +70,9 @@ export default class EmailSignUpPage extends React.Component {
                         className='btn btn-md btn-primary'
                         type='submit'
                     >
-                        Sign up
+                        {'Sign up'}
                     </button>
+                    {serverError}
                 </div>
                 <div className='form-group margin--extra-2x'>
                     <span><a href='/find_team'>{`Find my team`}</a></span>
-- 
cgit v1.2.3-1-g7c22

