Changeset 580ba1a for client_app
- Timestamp:
- 01/14/21 02:31:15 (4 years ago)
- Branches:
- master
- Children:
- be373a8
- Parents:
- df3a395
- Location:
- client_app/src
- Files:
-
- 5 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
client_app/src/components/main/App.js
rdf3a395 r580ba1a 17 17 import RegisterCompany from "../register/register_company_form"; 18 18 import RegisterTeam from "../register/register_team_form"; 19 import Search from "../filter/search"; 20 import EditUser from "../account_edit/user_edit"; 21 import EditCompany from "../account_edit/company_edit"; 19 22 20 23 class App extends Component{ … … 30 33 } 31 34 32 render(){35 render(){ 33 36 return( 34 37 <Router> … … 47 50 <Route path={"/register/company"} render={() => <RegisterCompany message={this.setSuccess} />}/> 48 51 <Route path={"/register/team"} render={() => <RegisterTeam message={this.setSuccess}/>}/> 52 <Route path={"/user/search"} render={() => <Search loggedIn={this.state.logged}/>}/> 53 <Route path={"/user/edit"} render={() => <EditUser oldUser={this.state.currentUser} updateUser={this.updateUser} message={this.setSuccess}/>}/> 54 <Route path={"/company/edit"} render={() => <EditCompany oldUser={this.state.currentUser} updateUser={this.updateUser} message={this.setSuccess}/>}/> 49 55 <Route path={"/logout"} render={() => <Redirect to={"/login"}/>}/> 50 56 <Route path={"/"} render={() => <Redirect to={"/login"}/>}/> … … 62 68 } 63 69 70 updateUser = (user) =>{ 71 this.setState({ 72 currentUser: user 73 }) 74 } 75 64 76 setSuccess = (message) => { 65 77 this.setState({ … … 70 82 attemptLogin = (email, password, type) => { 71 83 UserLogin.login(email, password, type).then((res) =>{ 72 console.log(res.data);73 84 if(res.data.email==null){ 74 85 this.setState({ -
client_app/src/components/profiles/company_profile.js
rdf3a395 r580ba1a 10 10 <h2>E-mail: {props.data.email}</h2> 11 11 <h3>Address: {props.data.address.country} {props.data.address.city} {props.data.address.street}</h3> 12 <Button primary as={Link} to={"/ profile/edit"}>Edit</Button>12 <Button primary as={Link} to={"/company/edit"}>Edit</Button> 13 13 </Container> 14 14 ); -
client_app/src/components/profiles/team_profile.js
rdf3a395 r580ba1a 10 10 <h2>E-mail: {props.data.email}</h2> 11 11 <h3>Members: {props.data.members}</h3> 12 <Button primary as={Link} to={"/ profile/edit"}>Edit</Button>12 <Button primary as={Link} to={"/team/edit"}>Edit</Button> 13 13 </Container> 14 14 ); -
client_app/src/components/register/register_company_form.js
rdf3a395 r580ba1a 13 13 password: "", 14 14 name:"", 15 members: "",15 country: "", 16 16 city: "", 17 17 street: "", … … 34 34 this.state.password, 35 35 this.state.name, 36 this.state.country 37 ,this.state.city,36 this.state.country, 37 this.state.city, 38 38 this.state.street 39 39 ).then(res =>{ … … 52 52 }).catch(err => { 53 53 this.setState({ 54 error: " Companyalready exists!",54 error: "User already exists!", 55 55 success: null 56 56 }) … … 58 58 } 59 59 60 componentDidMount(){61 this.props.message(null);62 }63 64 60 render() { 65 if (this.state.success!=null){66 return (61 if (this.state.success != null) { 62 return ( 67 63 <Redirect to={"/login"}/> 68 64 ); 69 65 } 70 66 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 67 return ( 68 <Container> 69 <h1 style={{color: "red"}}>{this.state.error}</h1> 70 <Form onSubmit={this.attemptCompanyRegister}> 71 <Form.Input id="email" name="email" type='email' required fluid label='E-mail' 72 placeholder='Enter e-mail.' onChange={this.handleCheck}/> 73 <Form.Input id="password" name="password" type='password' required fluid label='Password' 74 placeholder='Enter password.' onChange={this.handleCheck}/> 75 <Form.Input id="name" name="name" type='text' required fluid label='Name' 76 placeholder='Enter company name.' onChange={this.handleCheck}/> 77 <Form.Input id="country" name="country" type='text' required fluid label='Country' 78 placeholder='Enter your country.' onChange={this.handleCheck}/> 79 <Form.Input id="city" name="city" type='text' required fluid label='City' 80 placeholder='Enter your city.' onChange={this.handleCheck}/> 81 <Form.Input id="street" name="street" type='text' required fluid label='Street' 82 placeholder='Enter address street.' onChange={this.handleCheck}/> 83 <Form.Field control={Button}>Register</Form.Field> 84 </Form> 85 </Container> 86 ); 91 87 } 92 88 }
Note:
See TracChangeset
for help on using the changeset viewer.