Changeset 6f9b7b0 for client_app/src/components/data
- Timestamp:
- 01/10/21 21:16:40 (4 years ago)
- Branches:
- master
- Children:
- fc8421e
- Parents:
- 17abe5e
- Location:
- client_app/src/components/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
client_app/src/components/data/components/user_profile.js
r17abe5e r6f9b7b0 1 1 import React from 'react'; 2 import { Container, Header, List } from 'semantic-ui-react' 2 3 3 4 const UserDetails = (props) =>{ 4 5 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> 6 31 ); 7 32 } 33 34 export default UserDetails; -
client_app/src/components/data/profile.js
r17abe5e r6f9b7b0 1 1 import React from 'react'; 2 import {useHistory} from 'react-router-dom';3 import { render} from "@testing-library/react";2 import UserDetails from "./components/user_profile"; 3 import { Redirect } from "react-router-dom"; 4 4 5 5 const Profile = (props) => { 6 const history = useHistory();7 const userProfile = React.useState({8 userProfile: props.userProfile9 });10 6 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 ); 13 17 } 14 18 15 19 return( 16 < h1>?</h1>20 <Redirect to={"/login"}/> 17 21 ); 18 22 }
Note:
See TracChangeset
for help on using the changeset viewer.