@@ -11,7 +11,8 @@ import buildError from '../utils/buildError'
1111import AuthService from '../services/AuthService'
1212
1313const Register = ( ) => {
14- const [ name , setName ] = useState ( '' )
14+ const [ organisationName , setOrganisationName ] = useState ( '' )
15+ const [ username , setUsername ] = useState ( '' )
1516 const [ email , setEmail ] = useState ( '' )
1617 const [ password , setPassword ] = useState ( '' )
1718 const [ , setUser ] = useRecoilState ( userState )
@@ -31,7 +32,7 @@ const Register = () => {
3132 setLoading ( true )
3233
3334 try {
34- const res = await register ( { email, password, organisationName : name } )
35+ const res = await register ( { email, password, organisationName, username } )
3536 const accessToken = res . data . accessToken
3637 AuthService . setToken ( accessToken )
3738 setUser ( res . data . user )
@@ -48,11 +49,20 @@ const Register = () => {
4849
4950 < TextInput
5051 id = 'name'
51- label = 'Name '
52- placeholder = { 'Your name or your team/organisation \'s name' }
52+ label = 'Team name '
53+ placeholder = { 'Your team\'s name' }
5354 type = 'text'
54- onChange = { setName }
55- value = { name }
55+ onChange = { setOrganisationName }
56+ value = { organisationName }
57+ />
58+
59+ < TextInput
60+ id = 'username'
61+ label = 'Username'
62+ type = 'text'
63+ placeholder = 'Your name or a screen name'
64+ onChange = { setUsername }
65+ value = { username }
5666 />
5767
5868 < TextInput
@@ -76,7 +86,7 @@ const Register = () => {
7686 { error && < ErrorMessage error = { error } /> }
7787
7888 < Button
79- disabled = { ! name || ! email || ! password }
89+ disabled = { ! organisationName || ! username || ! email || ! password }
8090 onClick = { onRegisterClick }
8191 isLoading = { isLoading }
8292 >
0 commit comments