Changeset 21175ba


Ignore:
Timestamp:
01/15/21 03:52:52 (3 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
4302312
Parents:
0d7b1a9
Message:

Update App.js

File:
1 edited

Legend:

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

    r0d7b1a9 r21175ba  
    2424import InternshipRegister from "../work_register/internship_register";
    2525import ProjectRegister from "../work_register/project_register";
     26import EditJob from "../work_edit/test";
    2627
    2728class App extends Component{
     
    6162                      <Route path={"/register/internship"} render={() => <InternshipRegister accountId={this.state.currentUser.id} type={this.state.currentUser.type} updateInternships={this.updateInternships} />}/>
    6263                      <Route path={"/register/project"} render={() => <ProjectRegister accountId={this.state.currentUser.id} type={this.state.currentUser.type} updateProjects={this.updateProjects} />}/>
     64                      <Route path={"/edit/job"} render={(props) => <EditJob {...props}  editJob={this.editJob}/>} />
     65                      <Route path={"/edit/internship"} render={(props) => <EditInternship {...props}  editJob={this.editInternship}/>} />
     66                      <Route path={"/edit/project"} render={(props) => <EditProject {...props}  editJob={this.editProject}/>} />
    6367                      <Route path={"/logout"} render={() => <Redirect to={"/login"}/>}/>
    6468                      <Route path={"/"} render={() => <Redirect to={"/login"}/>}/>
     
    116120    }
    117121
     122    editJob = (job, index) => {
     123      this.setState(prevState => ({
     124          currentUser:{
     125              ...prevState.currentUser,
     126              jobs: Object.assign([],this.state.jobs,{[index]: job})
     127          }
     128      }))
     129    }
     130
     131    editInternship = (internship, index) => {
     132        this.setState(prevState => ({
     133            currentUser:{
     134                ...prevState.currentUser,
     135                internships: Object.assign([],this.state.jobs,{[index]: internship})
     136            }
     137        }))
     138    }
     139
     140    editProject = (project, index) => {
     141        this.setState(prevState => ({
     142            currentUser:{
     143                ...prevState.currentUser,
     144                projects: Object.assign([],this.state.jobs,{[index]: project})
     145            }
     146        }))
     147    }
     148
    118149  attemptLogin = (email, password, type) => {
    119150      UserLogin.login(email, password, type).then((res) =>{
Note: See TracChangeset for help on using the changeset viewer.