source: client_app/src/components/main/App.js@ 14b648e

Last change on this file since 14b648e was 3f5bf9e, checked in by Vzdra <vladko.zdravkovski@…>, 4 years ago

added test login

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