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 | |
---|
1 | import React, {Component} from 'react';
|
---|
2 | import {BrowserRouter as Router, Route} from 'react-router-dom';
|
---|
3 | import Login from '../login/login';
|
---|
4 | import Profile from "../data/profile";
|
---|
5 | import 'semantic-ui-css/semantic.min.css';
|
---|
6 | import HeaderComp from '../template/header';
|
---|
7 | import './App.css';
|
---|
8 | import UserLogin from "../../repository/login_repo";
|
---|
9 |
|
---|
10 | class 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 |
|
---|
44 | export default App;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.