Ignore:
Timestamp:
01/13/21 17:24:58 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
580ba1a
Parents:
7944fab
Message:

registration complete for all users

Location:
client_app/src/components
Files:
2 added
2 edited

Legend:

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

    r7944fab rdf3a395  
    1414import TeamJobs from "../work/team_jobs";
    1515import CompanyInternships from "../work/company_internships";
    16 import UserRegister from "../../repository/register_repo";
    1716import RegisterUser from "../register/register_user_form";
     17import RegisterCompany from "../register/register_company_form";
     18import RegisterTeam from "../register/register_team_form";
    1819
    1920class App extends Component{
     
    2324        logged: false,
    2425        error: null,
     26        success: null,
    2527        currentUser: {
    2628        }
     
    3335                  <HeaderComp acc={this.state.currentUser.email} accType={this.state.currentUser.type} name={this.state.currentUser.name} removeState={this.removeState}/>
    3436                  <main>
    35                       <Route path={"/login"} render={() => <Login error={this.state.error} onCompleteForm={this.attemptLogin} loggedIn={this.state.logged}/>}/>
     37                      <Route path={"/login"} render={() => <Login success={this.state.success} error={this.state.error} onCompleteForm={this.attemptLogin} loggedIn={this.state.logged}/>}/>
    3638                      <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>}/>
    3739                      <Route path={"/user/jobs"} render={() => <UserJobs userProfile={this.state.currentUser}/>}/>
     
    4244                      <Route path={"/company/jobs"} render={() => <CompanyJobs userProfile={this.state.currentUser}/>}/>
    4345                      <Route path={"/company/internships"} render={() => <CompanyInternships userProfile={this.state.currentUser}/>}/>
    44                       <Route path={"/register/user"} render={() => <RegisterUser error={null} success={null}/>}/>
     46                      <Route path={"/register/user"} render={() => <RegisterUser message={this.setSuccess} />}/>
     47                      <Route path={"/register/company"} render={() => <RegisterCompany message={this.setSuccess} />}/>
     48                      <Route path={"/register/team"} render={() => <RegisterTeam message={this.setSuccess}/>}/>
    4549                      <Route path={"/logout"} render={() => <Redirect to={"/login"}/>}/>
    4650                      <Route path={"/"} render={() => <Redirect to={"/login"}/>}/>
     
    5862  }
    5963
     64  setSuccess = (message) => {
     65      this.setState({
     66          success: message
     67      })
     68  }
    6069
    6170  attemptLogin = (email, password, type) => {
  • client_app/src/components/register/register_user_form.js

    r7944fab rdf3a395  
    66import UserRegister from "../../repository/register_repo";
    77import {Component} from "react/cjs/react.production.min";
     8import Login from "../login/login";
    89
    910class RegisterUser extends Component {
     
    1819            retainedSkills: [],
    1920            skillsToLearn: [],
    20             error: props.error,
    21             success: props.success,
     21            error: null,
     22            success: null,
    2223            sortedOptions:[]
    2324        }
     
    5859                    error: null
    5960                })
     61
     62                this.props.message(this.state.success);
    6063            }else{
    6164                this.setState({
     
    7376
    7477    render() {
    75         console.log(this.state.success);
    76 
    7778        if(this.state.success!=null){
    7879            return(
    79                 <Redirect to={"/login"} success={this.state.success}/>
     80                <Redirect to={"/login"}/>
    8081            );
    8182        }
     
    106107
    107108    componentDidMount(){
     109        this.props.message(null);
     110
    108111        SkillFetch.fetchAll().then((data) =>{
    109112            var sorted = [];
Note: See TracChangeset for help on using the changeset viewer.