Ignore:
Timestamp:
01/10/21 19:51:23 (3 years ago)
Author:
i-ina <76742075+i-ina@…>
Branches:
master
Children:
6f9b7b0
Parents:
a3d2b0d
Message:

react components for details and bugfix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client_app/src/components/main/App.js

    ra3d2b0d r17abe5e  
    22import {BrowserRouter as Router, Route} from 'react-router-dom';
    33import Login from '../login/login';
     4import Profile from "../data/profile";
    45import 'semantic-ui-css/semantic.min.css';
    56import HeaderComp from '../template/header';
     
    1112    super(props);
    1213    this.state = {
    13       id: null,
    14       email: null,
    15       name: null,
    16       type: null
     14      currentUser: {}
    1715    }
    1816  }
     
    2119      return(
    2220          <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}/>
    2422              <main>
    2523                  <Route path={"/login"} render={() => <Login onCompleteForm={this.attemptLogin}/>}/>
     24                  <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>}/>
    2625                  <Route path={"/"}/>
    2726                  <Route path={"/jobs"}/>
     
    3231  }
    3332
    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) =>{
    3636          console.log(res.data);
    3737          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
    4239          });
    4340      });
Note: See TracChangeset for help on using the changeset viewer.