Changeset be373a8 for client_app/src/components/account_edit
- Timestamp:
- 01/14/21 03:04:24 (4 years ago)
- Branches:
- master
- Children:
- db94dbd
- Parents:
- 580ba1a
- Location:
- client_app/src/components/account_edit
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
client_app/src/components/account_edit/company_edit.js
r580ba1a rbe373a8 11 11 super(props); 12 12 this.state = { 13 email: "", 14 password: "", 15 name:"", 16 members: "", 17 city: "", 18 street: "", 13 email: props.oldUser.email, 14 name: props.oldUser.name, 15 country: props.oldUser.address.country, 16 city: props.oldUser.address.city, 17 street: props.oldUser.address.street, 19 18 error: null, 20 success: null 19 success: null, 20 id: props.oldUser.id, 21 oldEmail: props.oldUser.email, 22 type: props.oldUser.type 21 23 } 22 24 this.attemptCompanyEdit = this.attemptCompanyEdit.bind(this); … … 32 34 attemptCompanyEdit = () => { 33 35 AccountEdit.companyEdit( 36 this.state.id, 37 this.state.oldEmail, 34 38 this.state.email, 35 this.state.password,36 39 this.state.name, 37 this.state.country 38 ,this.state.city,40 this.state.country, 41 this.state.city, 39 42 this.state.street 40 43 ).then(res =>{ 41 if(res.data.success!=null){ 42 this.setState({ 43 success: res.data.success, 44 error: null 45 }) 46 this.props.message(this.state.success); 47 }else{ 48 this.setState({ 49 error: res.data.error, 50 success: null 51 }) 52 } 44 this.setState({ 45 success: true, 46 error: null 47 }) 48 this.props.updateUser(res.data); 53 49 }).catch(err => { 54 50 this.setState({ … … 66 62 if(this.state.success!=null){ 67 63 return( 68 <Redirect to={"/login"}/> 64 <Redirect to={"/profile"}/> 65 ); 66 } 67 68 if(this.state.type!=="COMPANY"){ 69 return( 70 <Redirect to={"/profile"}/> 69 71 ); 70 72 } … … 73 75 <Container> 74 76 <h1 style={{color: "red"}}>{this.state.error}</h1> 75 <Form onSubmit={this.attemptCompany Register}>77 <Form onSubmit={this.attemptCompanyEdit}> 76 78 <Form.Input id="email" name="email" type='email' required fluid label='E-mail' 77 placeholder='Enter e-mail.' onChange={this.handleCheck}/> 78 <Form.Input id="password" name="password" type='password' required fluid label='Password' 79 placeholder='Enter password.' onChange={this.handleCheck}/> 79 placeholder='Enter e-mail.' value={this.state.email} onChange={this.handleCheck}/> 80 80 <Form.Input id="name" name="name" type='text' required fluid label='Name' 81 placeholder='Enter company name.' onChange={this.handleCheck}/>81 placeholder='Enter company name.' value={this.state.name} onChange={this.handleCheck}/> 82 82 <Form.Input id="country" name="country" type='text' required fluid label='Country' 83 placeholder='Enter your country.' onChange={this.handleCheck}/>84 <Form.Input id="city" name="city" type='text' required fluid label='City'83 placeholder='Enter your country.' value={this.state.country} onChange={this.handleCheck}/> 84 <Form.Input id="city" name="city" type='text' value={this.state.city} required fluid label='City' 85 85 placeholder='Enter your city.' onChange={this.handleCheck}/> 86 86 <Form.Input id="street" name="street" type='text' required fluid label='Street' 87 placeholder='Enter address street.' onChange={this.handleCheck}/>87 placeholder='Enter address street.' value={this.state.street} onChange={this.handleCheck}/> 88 88 <Form.Field control={Button}>Register</Form.Field> 89 89 </Form> -
client_app/src/components/account_edit/user_edit.js
r580ba1a rbe373a8 79 79 error: null 80 80 }) 81 81 82 this.props.updateUser(res.data); 82 83 }).catch(err => { 83 84 this.setState({ 84 85 success: null, 85 error: " Error editing user.",86 error: "User already exists.", 86 87 }) 87 88 });
Note:
See TracChangeset
for help on using the changeset viewer.