Changeset 19ad843


Ignore:
Timestamp:
01/13/21 01:08:25 (4 years ago)
Author:
i-ina <76742075+i-ina@…>
Branches:
master
Children:
7944fab
Parents:
351c43f
Message:

dropdown

Location:
client_app/src
Files:
3 edited

Legend:

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

    r351c43f r19ad843  
    1515import CompanyInternships from "../work/company_internships";
    1616import UserRegister from "../../repository/register_repo";
     17import RegisterUser from "../register/register_user_form";
    1718
    1819class App extends Component{
     
    3233                  <HeaderComp acc={this.state.currentUser.email} accType={this.state.currentUser.type} name={this.state.currentUser.name} removeState={this.removeState}/>
    3334                  <main>
    34                       <Route path={"/login"} render={() => <Login error={this.state.error} onCompleteForm={this.attemptLogin} loggedIn={this.state.logged}/>} />
    35                       <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>} />
    36                       <Route path={"/user/jobs"} render={() => <UserJobs userProfile={this.state.currentUser}/>} />
    37                       <Route path={"/user/internships"} render={() => <UserInternships userProfile={this.state.currentUser}/>} />
    38                       <Route path={"/user/projects"} render={() => <UserProjects userProfile={this.state.currentUser}/>} />
    39                       <Route path={"/team/jobs"} render={() => <TeamJobs userProfile={this.state.currentUser} />}/>
    40                       <Route path={"/team/projects"} render={() => <TeamProjects userProfile={this.state.currentUser} />}/>
    41                       <Route path={"/company/jobs"} render={() => <CompanyJobs userProfile={this.state.currentUser} />}/>
    42                       <Route path={"/company/internships"} render={() => <CompanyInternships userProfile={this.state.currentUser}/>} />
    43                       <Route path={"/profile/edit"} />
    44                       <Route path={"/job/edit"} />
    45                       <Route path={"/internship/edit"}/>
    46                       <Route path={"/project/edit"} />
     35                      <Route path={"/login"} render={() => <Login error={this.state.error} onCompleteForm={this.attemptLogin} loggedIn={this.state.logged}/>}/>
     36                      <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>}/>
     37                      <Route path={"/user/jobs"} render={() => <UserJobs userProfile={this.state.currentUser}/>}/>
     38                      <Route path={"/user/internships"} render={() => <UserInternships userProfile={this.state.currentUser}/>}/>
     39                      <Route path={"/user/projects"} render={() => <UserProjects userProfile={this.state.currentUser}/>}/>
     40                      <Route path={"/team/jobs"} render={() => <TeamJobs userProfile={this.state.currentUser}/>}/>
     41                      <Route path={"/team/projects"} render={() => <TeamProjects userProfile={this.state.currentUser}/>}/>
     42                      <Route path={"/company/jobs"} render={() => <CompanyJobs userProfile={this.state.currentUser}/>}/>
     43                      <Route path={"/company/internships"} render={() => <CompanyInternships userProfile={this.state.currentUser}/>}/>
     44                      <Route path={"/register/user"} render={() => <RegisterUser error={null}/>}/>
    4745                      <Route path={"/logout"} render={() => <Redirect to={"/login"}/>}/>
    4846                      <Route path={"/"} render={() => <Redirect to={"/login"}/>}/>
     
    7876      });
    7977
    80 
    81 
    82       registerUser = () =>{
    83           UserRegister.userRegister()
    84       }
    85 
    8678      if(this.state.currentUser.email!=null){
    8779          return <Redirect to={"/profile"}/>;
  • client_app/src/components/register/register_user_form.js

    r351c43f r19ad843  
    11import React from 'react';
    2 import { Button, Checkbox, Container, Form } from "semantic-ui-react";
     2import 'semantic-ui-react';
     3import {Button, Container, Form} from "semantic-ui-react";
    34import { Redirect } from 'react-router-dom';
    45import SkillFetch from "../../repository/skill_repo";
    56import UserRegister from "../../repository/register_repo";
     7import {Component} from "react/cjs/react.production.min";
    68
    79class RegisterUser extends Component {
     
    2123    }
    2224
     25    handleCheck = (e, {value}) => {
     26        this.setState({
     27            ...this.state,
     28            [e.target.name]: value
     29        })
     30    }
     31
    2332    render() {
    2433        return (
     
    2736                <Form onSubmit={this.attemptRegister}>
    2837                    <Form.Input id="email" name="email" type='email' required fluid label='E-mail'
    29                                 placeholder='Enter e-mail.' onChange={handleCheck}/>
     38                                placeholder='Enter e-mail.' onChange={this.handleCheck}/>
    3039                    <Form.Input id="password" name="password" type='password' required fluid label='Password'
    31                                 placeholder='Enter password.' onChange={handleCheck}/>
    32                                
     40                                placeholder='Enter password.' onChange={this.handleCheck}/>
     41                    <Form.Input id="name" name="name" type='text' required fluid label='Name'
     42                                placeholder='Enter name.' onChange={this.handleCheck}/>
     43                    <Form.Input id="surname" name="surname" type='text' required fluid label='Surname'
     44                                placeholder='Enter surname.' onChange={this.handleCheck}/>
     45                                <label>Skills you know:</label>
     46                    <select multiple="" class="ui dropdown">
     47                        {this.state.allSkills.map(item => {
     48                            return <option value={item.id}>{item.name}</option>
     49                        })}
     50                    </select>
    3351                    <Button type="submit">Register</Button>
    3452                </Form>
     
    4058        SkillFetch.fetchAll().then((data) =>{
    4159            this.setState({
    42                 allSkills: data
     60                allSkills: data.data
    4361            })
    4462        })
  • client_app/src/repository/skill_repo.js

    r351c43f r19ad843  
    33const SkillFetch = {
    44    fetchAll: () => {
    5         return axios.get("/api/skills");
     5        return axios.get("/skills");
    66    }
    77}
Note: See TracChangeset for help on using the changeset viewer.