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

work register

Location:
client_app/src/components
Files:
3 added
5 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) =>{
  • client_app/src/components/work/company_internships.js

    rbe373a8 rdb94dbd  
    1010            return(
    1111                <Container textAlign="left">
    12                     <Button as={Link} to={"/internships/add"} primary>Add</Button>
    13                     <h1>Registered Jobs:</h1>
     12                    <Button as={Link} to={"/register/internship"} primary>Add</Button>
     13                    <h1>Registered Internships:</h1>
    1414                    {props.userProfile.internships.map(item =>{
    1515                        return <Internships
  • client_app/src/components/work/company_jobs.js

    rbe373a8 rdb94dbd  
    1010            return(
    1111                <Container textAlign="left">
    12                     <Button as={Link} to={"/job/add"} primary>Add</Button>
     12                    <Button as={Link} to={"/register/job"} primary>Add</Button>
    1313                    <h1>Registered Jobs:</h1>
    1414                    {props.userProfile.jobs.map(item =>{
  • client_app/src/components/work/team_jobs.js

    rbe373a8 rdb94dbd  
    1010            return(
    1111                <Container textAlign="left">
    12                     <Button as={Link} to={"/job/add"} primary>Add</Button>
     12                    <Button as={Link} to={"/register/job"} primary>Add</Button>
    1313                    <h1>Registered Jobs:</h1>
    1414                    {props.userProfile.jobs.map(item =>{
  • client_app/src/components/work/team_projects.js

    rbe373a8 rdb94dbd  
    1010            return(
    1111                <Container textAlign="left">
    12                     <Button as={Link} to={"/project/add"} primary>Add</Button>
    13                     <h1>Registered Jobs:</h1>
     12                    <Button as={Link} to={"/register/project"} primary>Add</Button>
     13                    <h1>Registered Projects:</h1>
    1414                    {props.userProfile.projects.map(item =>{
    1515                        return <Projects
Note: See TracChangeset for help on using the changeset viewer.