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
RevLine 
[3f5bf9e]1import React, {Component} from 'react';
2import {BrowserRouter as Router, Route} from 'react-router-dom';
3import Login from '../login/login';
[17abe5e]4import Profile from "../data/profile";
[3f5bf9e]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 = {
[17abe5e]14 currentUser: {}
[3f5bf9e]15 }
16 }
17
18 render(){
19 return(
20 <Router>
[17abe5e]21 <HeaderComp acc={this.state.currentUser.email} accType={this.state.currentUser.type} name={this.state.currentUser.name}/>
[3f5bf9e]22 <main>
23 <Route path={"/login"} render={() => <Login onCompleteForm={this.attemptLogin}/>}/>
[17abe5e]24 <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>}/>
[3f5bf9e]25 <Route path={"/"}/>
26 <Route path={"/jobs"}/>
27 <Route path={"/internships"}/>
28 </main>
29 </Router>
30 );
31 }
32
[17abe5e]33 attemptLogin = (email, password, type) => {
34
35 UserLogin.login(email, password, type).then((res) =>{
[3f5bf9e]36 console.log(res.data);
37 this.setState({
[17abe5e]38 currentUser: res.data
[3f5bf9e]39 });
40 });
41 }
42}
43
44export default App;
Note: See TracBrowser for help on using the repository browser.