Ignore:
Timestamp:
01/14/21 22:54:45 (3 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
5b36317
Parents:
be373a8
Message:

work register

File:
1 edited

Legend:

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

    rbe373a8 rdb94dbd  
    2121import EditCompany from "../account_edit/company_edit";
    2222import EditTeam from "../account_edit/team_edit";
     23import JobRegister from "../work_register/job_register";
     24import InternshipRegister from "../work_register/internship_register";
     25import ProjectRegister from "../work_register/project_register";
    2326
    2427class App extends Component{
     
    5558                      <Route path={"/company/edit"} render={() => <EditCompany oldUser={this.state.currentUser} updateUser={this.updateUser} message={this.setSuccess}/>}/>
    5659                      <Route path={"/team/edit"} render={() => <EditTeam oldUser={this.state.currentUser} updateUser={this.updateUser} message={this.setSuccess}/>}/>
     60                      <Route path={"/register/job"} render={() => <JobRegister accountId={this.state.currentUser.id} type={this.state.currentUser.type} updateJobs={this.updateJobs} />}/>
     61                      <Route path={"/register/internship"} render={() => <InternshipRegister accountId={this.state.currentUser.id} type={this.state.currentUser.type} updateInternships={this.updateInternships} />}/>
     62                      <Route path={"/register/project"} render={() => <ProjectRegister accountId={this.state.currentUser.id} type={this.state.currentUser.type} updateInternships={this.updateProjects} />}/>
    5763                      <Route path={"/logout"} render={() => <Redirect to={"/login"}/>}/>
    5864                      <Route path={"/"} render={() => <Redirect to={"/login"}/>}/>
     
    8389  }
    8490
     91  updateJobs = (job) => {
     92      this.setState(prevState => ({
     93         currentUser:{
     94             ...prevState.currentUser,
     95             jobs: [...prevState.currentUser.jobs, job]
     96         }
     97      }))
     98  }
     99
     100    updateInternships = (internship) => {
     101        this.setState(prevState => ({
     102            currentUser:{
     103                ...prevState.currentUser,
     104                internships: [...prevState.currentUser.internships, internship]
     105            }
     106        }))
     107    }
     108
     109    updateProjects = (project) => {
     110        this.setState(prevState => ({
     111            currentUser:{
     112                ...prevState.currentUser,
     113                projects: [...prevState.currentUser.projects, project]
     114            }
     115        }))
     116    }
     117
    85118  attemptLogin = (email, password, type) => {
    86119      UserLogin.login(email, password, type).then((res) =>{
Note: See TracChangeset for help on using the changeset viewer.