Changeset 17abe5e for client_app/src/components/main
- Timestamp:
- 01/10/21 19:51:23 (4 years ago)
- Branches:
- master
- Children:
- 6f9b7b0
- Parents:
- a3d2b0d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client_app/src/components/main/App.js
ra3d2b0d r17abe5e 2 2 import {BrowserRouter as Router, Route} from 'react-router-dom'; 3 3 import Login from '../login/login'; 4 import Profile from "../data/profile"; 4 5 import 'semantic-ui-css/semantic.min.css'; 5 6 import HeaderComp from '../template/header'; … … 11 12 super(props); 12 13 this.state = { 13 id: null, 14 email: null, 15 name: null, 16 type: null 14 currentUser: {} 17 15 } 18 16 } … … 21 19 return( 22 20 <Router> 23 <HeaderComp acc={this.state. email} accType={this.state.type} name={this.state.name}/>21 <HeaderComp acc={this.state.currentUser.email} accType={this.state.currentUser.type} name={this.state.currentUser.name}/> 24 22 <main> 25 23 <Route path={"/login"} render={() => <Login onCompleteForm={this.attemptLogin}/>}/> 24 <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>}/> 26 25 <Route path={"/"}/> 27 26 <Route path={"/jobs"}/> … … 32 31 } 33 32 34 attemptLogin = (username, password, type) => { 35 UserLogin.login(username, password, type).then((res) =>{ 33 attemptLogin = (email, password, type) => { 34 35 UserLogin.login(email, password, type).then((res) =>{ 36 36 console.log(res.data); 37 37 this.setState({ 38 id: res.data.id, 39 email: res.data.email, 40 name: res.data.name, 41 type: res.data.type 38 currentUser: res.data 42 39 }); 43 40 });
Note:
See TracChangeset
for help on using the changeset viewer.