Ignore:
Timestamp:
01/10/21 21:16:40 (3 years ago)
Author:
i-ina <76742075+i-ina@…>
Branches:
master
Children:
fc8421e
Parents:
17abe5e
Message:

user login

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

Legend:

Unmodified
Added
Removed
  • client_app/src/components/data/components/user_profile.js

    r17abe5e r6f9b7b0  
    11import React from 'react';
     2import { Container, Header, List } from 'semantic-ui-react'
    23
    34const UserDetails = (props) =>{
    45    return(
    5        
     6        <Container>
     7            <Header>Welcome</Header>
     8            <br />
     9            <h3>User: {props.data.name}</h3>
     10            <table>
     11                <tr>
     12                    <td>
     13                        <h3>Retained skills</h3>
     14                        <ul>
     15                        {props.data.retained.map((value, index) => {
     16                            return <li key={index}>{value.name}</li>
     17                        })}
     18                        </ul>
     19                    </td>
     20                    <td>
     21                        <h3>Skills you want to learn</h3>
     22                        <ul>
     23                            {props.data.toLearn.map((value, index) => {
     24                                return <li key={index}>{value.name}</li>
     25                            })}
     26                        </ul>
     27                    </td>
     28                </tr>
     29            </table>
     30        </Container>
    631    );
    732}
     33
     34export default UserDetails;
  • client_app/src/components/data/profile.js

    r17abe5e r6f9b7b0  
    11import React from 'react';
    2 import {useHistory} from 'react-router-dom';
    3 import {render} from "@testing-library/react";
     2import UserDetails from "./components/user_profile";
     3import { Redirect } from "react-router-dom";
    44
    55const Profile = (props) => {
    6     const history = useHistory();
    7     const userProfile = React.useState({
    8         userProfile: props.userProfile
    9     });
    106
    11     if(props.userProfile.email==null){
    12         history.push("/");
     7    if(props.userProfile.type==="USER"){
     8        return (
     9          <UserDetails data={{
     10               email: props.userProfile.email,
     11               name: props.userProfile.name,
     12               surname: props.userProfile.surname,
     13               retained: props.userProfile.retained,
     14               toLearn: props.userProfile.toLearn
     15          }}/>
     16        );
    1317    }
    1418
    1519    return(
    16         <h1>?</h1>
     20        <Redirect to={"/login"}/>
    1721    );
    1822}
Note: See TracChangeset for help on using the changeset viewer.