source: client_app/src/components/main/App.js@ 17abe5e

Last change on this file since 17abe5e was 17abe5e, checked in by i-ina <76742075+i-ina@…>, 4 years ago

react components for details and bugfix

  • Property mode set to 100644
File size: 1.3 KB
Line 
1import React, {Component} from 'react';
2import {BrowserRouter as Router, Route} from 'react-router-dom';
3import Login from '../login/login';
4import Profile from "../data/profile";
5import 'semantic-ui-css/semantic.min.css';
6import HeaderComp from '../template/header';
7import './App.css';
8import UserLogin from "../../repository/login_repo";
9
10class App extends Component{
11 constructor(props) {
12 super(props);
13 this.state = {
14 currentUser: {}
15 }
16 }
17
18 render(){
19 return(
20 <Router>
21 <HeaderComp acc={this.state.currentUser.email} accType={this.state.currentUser.type} name={this.state.currentUser.name}/>
22 <main>
23 <Route path={"/login"} render={() => <Login onCompleteForm={this.attemptLogin}/>}/>
24 <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>}/>
25 <Route path={"/"}/>
26 <Route path={"/jobs"}/>
27 <Route path={"/internships"}/>
28 </main>
29 </Router>
30 );
31 }
32
33 attemptLogin = (email, password, type) => {
34
35 UserLogin.login(email, password, type).then((res) =>{
36 console.log(res.data);
37 this.setState({
38 currentUser: res.data
39 });
40 });
41 }
42}
43
44export default App;
Note: See TracBrowser for help on using the repository browser.