Guest User

pankaj

a guest
Sep 12th, 2017
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, {Component} from 'react';
  2. import axios from 'axios';
  3. import AppBar from 'material-ui/AppBar';
  4. import MenuItem from 'material-ui/MenuItem';
  5. import Drawer from 'material-ui/Drawer';
  6. import logo from './logo.png';
  7. import {
  8.   BrowserRouter as Router,
  9.   Route,
  10.   Switch,
  11.   Link,
  12.   Redirect,
  13. } from 'react-router-dom'
  14. import {
  15.   Table,
  16.   TableBody,
  17.   TableHeader,
  18.   TableHeaderColumn,
  19.   TableRow,
  20.   TableRowColumn,
  21. } from 'material-ui/Table';
  22. import {rootURL} from './API'
  23. import DialogExampleSimple from './DialogExampleSimple'
  24. import {Card, CardHeader, CardText, CardActions} from 'material-ui/Card';
  25. import RaisedButton from 'material-ui/RaisedButton';
  26. import TextField from 'material-ui/TextField';
  27. import Person from 'material-ui/svg-icons/social/person';
  28. import Divider from 'material-ui/Divider';
  29. import FlatButton from 'material-ui/FlatButton';
  30. import {login, logout, loggedIn} from './auth'
  31.  
  32. class ScoreRequest extends Component {
  33.   state = {
  34.     requests: [],
  35.     hightlight: false,
  36.   };
  37.  
  38.   componentDidMount() {
  39.     axios
  40.       .get(rootURL + '/api/ScoreResponse/?ordering=-id', {
  41.         headers: {
  42.           'Authorization': 'Token ' + localStorage.token
  43.         }
  44.       })
  45.       .then(res => {
  46.         const requests = res.data
  47.         this.setState({ requests })
  48.       })
  49.   }
  50.  
  51.   hightlight(value) {
  52.     this.setState({hightlight: value})
  53.     this.componentDidMount()
  54.     setTimeout(() => {this.setState({hightlight: false});}, 3500);
  55.   }
  56.  
  57.   render() {
  58.     const requests = this.state.requests
  59.     const hightlight = this.state.hightlight
  60.  
  61.     return (
  62.       <div>
  63.         <h2>Score Requests</h2>
  64.         <DialogExampleSimple hightlight={this.hightlight.bind(this)}/>
  65.         <Table>
  66.           <TableHeader displaySelectAll={false} adjustForCheckbox={false}>
  67.             <TableRow>
  68.               <TableHeaderColumn>Company Name</TableHeaderColumn>
  69.               <TableHeaderColumn>Instrument</TableHeaderColumn>
  70.               <TableHeaderColumn>Maturity Date</TableHeaderColumn>
  71.               <TableHeaderColumn>Tenor</TableHeaderColumn>
  72.               <TableHeaderColumn>Request Date</TableHeaderColumn>
  73.               <TableHeaderColumn>Actions</TableHeaderColumn>
  74.             </TableRow>
  75.           </TableHeader>
  76.           <TableBody displayRowCheckbox={false}>
  77.             {requests ? requests.map(item => {
  78.               return (
  79.                 <TableRow key={item.score_request.id} selected={hightlight && hightlight === item.score_request.id ? true : false}>
  80.                   <TableRowColumn style={{
  81.                     whiteSpace: 'normal',
  82.                     wordWrap: 'break-word'}}>{item.score_request.company.name}</TableRowColumn>
  83.                   <TableRowColumn>{item.score_request.instrument.name}</TableRowColumn>
  84.                   <TableRowColumn>{item.score_request.maturity_call_date.slice(0, 10)}</TableRowColumn>
  85.                   <TableRowColumn>{item.score_request.tenor}</TableRowColumn>
  86.                   <TableRowColumn>{item.modified.slice(0, 10)}</TableRowColumn>
  87.                   <TableRowColumn><Link to={"/score-request/"+ item.id} >View</Link> | Download</TableRowColumn>
  88.                 </TableRow>
  89.               )
  90.             }) : null}
  91.           </TableBody>
  92.         }
  93.         </Table>
  94.     </div>
  95.     );
  96.   }
  97. }
  98.  
  99.  
  100. class Logout extends Component {
  101.   state = {
  102.     redirect: false
  103.   }
  104.  
  105.   componentWillMount() {
  106.     logout()
  107.     this.setState({redirect: true})
  108.   }
  109.  
  110.   render() {
  111.     const redirect = this.state
  112.     return redirect ? <Redirect to={{ pathname: '/login' }}/> : null
  113.   }
  114. }
  115.  
  116.  
  117. class Home extends Component {
  118.   render() {
  119.     return <Redirect to={{ pathname: '/score-request' }}/>
  120.   }
  121. }
  122.  
  123. class Login extends Component {
  124.   state = {
  125.     redirectToReferrer: false,
  126.     username: '',
  127.     password: ''
  128.   }
  129.  
  130.   handleLogin() {
  131.     if (localStorage.token) {
  132.       this.setState({redirectToReferrer:true})
  133.     }
  134.     login(this.state.username, this.state.password).then(() => this.setState({redirectToReferrer:true}))
  135.   }
  136.  
  137.   render() {
  138.     const { from } = this.props.location.state || { from: { pathname: '/score-request/' } }
  139.     const { redirectToReferrer } = this.state
  140.    
  141.     if (redirectToReferrer) {
  142.       return (
  143.         <Redirect to={from}/>
  144.       )
  145.     }
  146.  
  147.     return (
  148.       <div>
  149.          <TextField
  150.            hintText="Enter your Username"
  151.            floatingLabelText="Username"
  152.            onChange = {(event,newValue) => this.setState({username:newValue})}
  153.            />
  154.          <br/>
  155.            <TextField
  156.              type="password"
  157.              hintText="Enter your Password"
  158.              floatingLabelText="Password"
  159.              onChange = {(event,newValue) => this.setState({password:newValue})}
  160.              />
  161.            <br/>
  162.            <RaisedButton label="Login" primary={true} onClick={this.handleLogin.bind(this)}/>
  163.       </div>
  164.     );
  165.     }
  166. }
  167.  
  168.  
  169. class Request extends Component {
  170.   state = {
  171.     // booleans
  172.     fetched: false,
  173.     editScore: false,
  174.     editFinalScore: false,
  175.     expanded: true,
  176.     expandedFinalScore:true,
  177.     // ---
  178.     id: 0,
  179.     base_score: 0.0,
  180.     "industry_modifier": 0.0,
  181.     "pb_modifier": 0.0,
  182.     "z_score_modifier": 0.0,
  183.     "financial_modifier": 0.0,
  184.     "instrument_modifier": 0.0,
  185.     "management_quality_modifier": 0.0,
  186.     "final_score": 0.0,
  187.     "pd_spread": 0.0,
  188.     "lgd_percentage": 0.0,
  189.     "treasury_yield": 0.0,
  190.     "fair_yield": 0.0,
  191.     "final_yield": 0.0,
  192.     "score_request": {
  193.       company: {
  194.         accord_code: 0,
  195.         name: ''
  196.       }
  197.     }
  198.   };
  199.  
  200.   handleTextInputChange = (event) => {
  201.     this.setState({
  202.       [event.target.name]: event.target.value,
  203.     });
  204.   };
  205.  
  206.   componentDidMount() {
  207.     axios
  208.       .get(rootURL + '/api/ScoreResponse/' + this.props.match.params.id + '/', {
  209.         headers: {
  210.           'Authorization': 'Token ' + localStorage.token
  211.         }
  212.       })
  213.       .then(res => {
  214.         const request = res.data
  215.         this.setState(request)
  216.         this.setState({fetched:true})
  217.       })
  218.       .catch(err => {
  219.         this.setState({fetched:false})
  220.       })
  221.   }
  222.  
  223.   submitForm() {
  224.     var payload = {
  225.       base_score: this.state.base_score,
  226.       industry_modifier: this.state.industry_modifier,
  227.       pb_modifier: this.state.pb_modifier,
  228.       z_score_modifier: this.state.z_score_modifier,
  229.       financial_modifier: this.state.financial_modifier,
  230.       instrument_modifier: this.state.instrument_modifier,
  231.       management_quality_modifier: this.state.management_quality_modifier,
  232.       final_score: this.state.final_score,
  233.       pd_spread: this.state.pd_spread,
  234.       lgd_percentage: this.state.lgd_percentage,
  235.       treasury_yield: this.state.treasury_yield,
  236.       fair_yield: this.state.fair_yield,
  237.       final_yield: this.state.final_yield,
  238.     }
  239.     axios.put(rootURL + '/api/ScoreResponse/' + this.props.match.params.id + '/', payload)
  240.       .then(response => {
  241.         console.log(response.data);
  242.         this.setState({editScore:false, editFinalScore: false})
  243.       }).catch(error => {
  244.         this.setState({error:error.response})
  245.         console.log('error', error.response)
  246.       })
  247.   }
  248.  
  249.   render() {
  250.     const request = this.state
  251.     const scoreRequest = request.score_request
  252.     const editScore = this.state.editScore
  253.     const editFinalScore = this.state.editFinalScore
  254.     const fetched = this.state.fetched
  255.     const industryMapping = {
  256.       1: 'Public Manufacturin',
  257.       2: 'Private Manufacturing',
  258.       3: 'Others',
  259.     }
  260.     console.log(this.state)
  261.     return (
  262.       <div>
  263.         {fetched && scoreRequest ?
  264.         <div>
  265.           <br />
  266.           <Card>
  267.             <CardHeader
  268.               title={<span><span style={{color:'grey'}}>Score Request: </span>{scoreRequest.company.name}</span>}
  269.               subtitle={
  270.                 scoreRequest.company.accord_code
  271.                 + ' | ' +
  272.                 scoreRequest.company.sector.name
  273.                 + ' | ' +
  274.                 (scoreRequest.company.listing_status === 1 ? 'Listed' :'UnListed')}
  275.               actAsExpander={true}
  276.               showExpandableButton={true}
  277.               titleStyle={{fontSize:25}}
  278.             />
  279.             <CardText expandable={true}>
  280.               <div>
  281.             <Table>
  282.                 <TableBody displayRowCheckbox={false}>
  283.                   <TableRow>
  284.                     <TableRowColumn style={{width:250}}><strong>Company Rating:</strong></TableRowColumn>
  285.                     <TableRowColumn>{scoreRequest.company_rating.name}</TableRowColumn>
  286.                   </TableRow>
  287.                   <TableRow>
  288.                     <TableRowColumn><strong>Company Rating Agency:</strong></TableRowColumn>
  289.                     <TableRowColumn> {scoreRequest.company_rating_agency.name}</TableRowColumn>
  290.                   </TableRow>
  291.                   <TableRow>
  292.                     <TableRowColumn><strong>Instrument:</strong></TableRowColumn>
  293.                     <TableRowColumn>{scoreRequest.instrument.name}</TableRowColumn>
  294.                   </TableRow>
  295.                   <TableRow>
  296.                     <TableRowColumn><strong>Instrument Rating:</strong></TableRowColumn>
  297.                     <TableRowColumn>{scoreRequest.instrument_rating}</TableRowColumn>
  298.                   </TableRow>
  299.                   <TableRow>
  300.                     <TableRowColumn><strong>Instrument Rating Agency:</strong></TableRowColumn>
  301.                     <TableRowColumn> {scoreRequest.instrument_rating_agency}</TableRowColumn>
  302.                   </TableRow>
  303.                   <TableRow>
  304.                     <TableRowColumn><strong>Type of Industry:</strong></TableRowColumn>
  305.                     <TableRowColumn> {industryMapping[scoreRequest.type_of_industry]}</TableRowColumn>
  306.                   </TableRow>
  307.                   <TableRow>
  308.                     <TableRowColumn><strong>Maturity Date:</strong></TableRowColumn>
  309.                     <TableRowColumn>{scoreRequest.maturity_call_date}</TableRowColumn>
  310.                   </TableRow>
  311.                   <TableRow>
  312.                     <TableRowColumn><strong>Tenor:</strong></TableRowColumn>
  313.                     <TableRowColumn>{scoreRequest.tenor}</TableRowColumn>
  314.                   </TableRow>
  315.                   <TableRow>
  316.                     <TableRowColumn><strong>For Year:</strong></TableRowColumn>
  317.                     <TableRowColumn>{scoreRequest.for_year}</TableRowColumn>
  318.                   </TableRow>
  319.                   <TableRow>
  320.                     <TableRowColumn><strong>YTM offered:</strong></TableRowColumn>
  321.                     <TableRowColumn>{scoreRequest.ytm_offered}</TableRowColumn>
  322.                   </TableRow>
  323.                 </TableBody>
  324.               </Table>
  325.               </div>
  326.             </CardText>
  327.           </Card>
  328.           <br />
  329.           <Card expanded={this.state.expanded} onExpandChange={(expanded)=> {this.setState({expanded})}}>
  330.             <CardHeader
  331.               title="Score"
  332.               actAsExpander={true}
  333.               showExpandableButton={true}
  334.               titleStyle={{fontSize:25}}
  335.             />
  336.             <CardActions>
  337.               <RaisedButton label="View" primary={true} onClick={() => {this.setState({editScore: false, expanded: true})}}/>
  338.               <RaisedButton label="Edit" primary={true} onClick={() => {this.setState({editScore: true, expanded: true})}}/>
  339.             </CardActions>
  340.             <CardText expandable={true}>
  341.               {editScore ?
  342.                 <form>
  343.                   <div className="grid-x">
  344.                       <TextField
  345.                         floatingLabelText="BaseScore"
  346.                         name='base_score'
  347.                         value={request.base_score}
  348.                         onChange={this.handleTextInputChange}
  349.                         />
  350.                   </div>
  351.                   <div className="grid-x">
  352.                       <TextField
  353.                         floatingLabelText="Industry Modifier"
  354.                         name='industry_modifier'
  355.                         value={request.industry_modifier}
  356.                         onChange={this.handleTextInputChange}
  357.                         />
  358.                   </div>
  359.                   <div className="grid-x">
  360.                     <TextField
  361.                       floatingLabelText="PB Modifier"
  362.                       name='pb_modifier'
  363.                       value={request.pb_modifier}
  364.                       onChange={this.handleTextInputChange}
  365.                       />
  366.                   </div>
  367.                   <div className="grid-x">
  368.                     <TextField
  369.                       floatingLabelText="Z Score Modifier"
  370.                       name='z_score_modifier'
  371.                       value={request.z_score_modifier}
  372.                       onChange={this.handleTextInputChange}
  373.                       />
  374.                   </div>
  375.                   <div className="grid-x">
  376.                     <TextField
  377.                       floatingLabelText="Financial Modifier"
  378.                       name='financial_modifier'
  379.                       value={request.financial_modifier}
  380.                       onChange={this.handleTextInputChange}
  381.                       />
  382.                   </div>
  383.                   <div className="grid-x">
  384.                     <TextField
  385.                       floatingLabelText="Instrument Modifier"
  386.                       name='instrument_modifier'
  387.                       value={request.instrument_modifier}
  388.                       onChange={this.handleTextInputChange}
  389.                       />
  390.                   </div>
  391.                   <div className="grid-x">
  392.                     <TextField
  393.                       floatingLabelText="Management Quality Modifier"
  394.                       name='management_quality_modifier'
  395.                       value={request.management_quality_modifier}
  396.                       onChange={this.handleTextInputChange}
  397.                       />
  398.                   </div>
  399.                   <div className="grid-x">
  400.                     <TextField
  401.                       floatingLabelText="Final Score"
  402.                       name='final_score'
  403.                       disabled={true}
  404.                       value={request.final_score}
  405.                       onChange={this.handleTextInputChange}
  406.                       />
  407.                   </div>
  408.                   <br />
  409.                   <RaisedButton label="Submit" primary={true} onClick={this.submitForm.bind(this)}/>
  410.                 </form>
  411.               :
  412.               <div>
  413.               <Table>
  414.                 <TableBody displayRowCheckbox={false}>
  415.                   <TableRow>
  416.                     <TableRowColumn style={{width:250}}><strong>BaseScore:</strong></TableRowColumn>
  417.                     <TableRowColumn>{request.base_score}</TableRowColumn>
  418.                   </TableRow>
  419.                   <TableRow>
  420.                     <TableRowColumn><strong>Industry Modifier:</strong></TableRowColumn>
  421.                     <TableRowColumn>{request.industry_modifier}</TableRowColumn>
  422.                   </TableRow>
  423.                   <TableRow>
  424.                     <TableRowColumn><strong>PB Modifier:</strong></TableRowColumn>
  425.                     <TableRowColumn> {request.pb_modifier}</TableRowColumn>
  426.                   </TableRow>
  427.                   <TableRow>
  428.                     <TableRowColumn><strong>Z Score Modifier:</strong></TableRowColumn>
  429.                     <TableRowColumn>{request.z_score_modifier}</TableRowColumn>
  430.                   </TableRow>
  431.                   <TableRow>
  432.                     <TableRowColumn><strong>Financial Modifier:</strong></TableRowColumn>
  433.                     <TableRowColumn>{request.financial_modifier}</TableRowColumn>
  434.                   </TableRow>
  435.                   <TableRow>
  436.                     <TableRowColumn><strong>Instrument Modifier:</strong></TableRowColumn>
  437.                     <TableRowColumn>{request.instrument_modifier}</TableRowColumn>
  438.                   </TableRow>
  439.                   <TableRow>
  440.                     <TableRowColumn><strong>Management Quality Modifier:</strong></TableRowColumn>
  441.                     <TableRowColumn>{request.management_quality_modifier}</TableRowColumn>
  442.                   </TableRow>
  443.                   <TableRow>
  444.                     <TableRowColumn><strong>Final Score:</strong></TableRowColumn>
  445.                     <TableRowColumn>{request.final_score}</TableRowColumn>
  446.                   </TableRow>
  447.                 </TableBody>
  448.               </Table>
  449.               </div>
  450.               }
  451.             </CardText>
  452.           </Card>
  453.           <Card expanded={this.state.expandedFinalScore} onExpandChange={(expandedFinalScore)=> {this.setState({expandedFinalScore})}}>
  454.             <CardHeader
  455.               title="Final Score"
  456.               actAsExpander={true}
  457.               showExpandableButton={true}
  458.               titleStyle={{fontSize:25}}
  459.             />
  460.             <CardActions>
  461.               <RaisedButton label="View" primary={true} onClick={() => {this.setState({editFinalScore: false, expandedFinalScore: true})}}/>
  462.               <RaisedButton label="Edit" primary={true} onClick={() => {this.setState({editFinalScore: true, expandedFinalScore: true})}}/>
  463.             </CardActions>
  464.             <CardText expandable={true}>
  465.  
  466.               {editFinalScore ?
  467.                 <form>
  468.                 <br />
  469.                 <div className="grid-x">
  470.                   <TextField
  471.                     floatingLabelText="PD Spread"
  472.                     name='pd_spread'
  473.                     value={request.pd_spread}
  474.                     onChange={this.handleTextInputChange}
  475.                     />
  476.                 </div>
  477.                 <div className="grid-x">
  478.                     <TextField
  479.                       floatingLabelText="LGD Percentage"
  480.                       name='lgd_percentage'
  481.                       value={request.lgd_percentage}
  482.                       onChange={this.handleTextInputChange}
  483.                       />
  484.                 </div>
  485.                 <div className="grid-x">
  486.                     <TextField
  487.                       floatingLabelText="Treasury Yield"
  488.                       name='treasury_yield'
  489.                       value={request.treasury_yield}
  490.                       onChange={this.handleTextInputChange}
  491.                       />
  492.                   </div>  
  493.                 <div className="grid-x">
  494.                     <TextField
  495.                       floatingLabelText="Fair Yield"
  496.                       name='fair_yield'
  497.                       value={request.fair_yield}
  498.                       disabled={true}
  499.                       onChange={this.handleTextInputChange}
  500.                       />
  501.                 </div>
  502.                 <div className="grid-x">
  503.                   <TextField
  504.                     floatingLabelText="Final Yield"
  505.                     name='final_yield'
  506.                     value={request.final_yield}
  507.                     onChange={this.handleTextInputChange}
  508.                     />
  509.                 </div>
  510.                 <br />
  511.                 <RaisedButton label="Submit" primary={true} onClick={this.submitForm.bind(this)}/>
  512.                 </form>
  513.  
  514.               :
  515.               <div>
  516.               <Table>
  517.                 <TableBody displayRowCheckbox={false}>
  518.                   <TableRow>
  519.                     <TableRowColumn style={{width:250}}><strong>PD Spread:</strong></TableRowColumn>
  520.                     <TableRowColumn>{request.pd_spread}</TableRowColumn>
  521.                   </TableRow>
  522.                   <TableRow>
  523.                     <TableRowColumn><strong>LGD Percentage:</strong></TableRowColumn>
  524.                     <TableRowColumn>{request.lgd_percentage}</TableRowColumn>
  525.                   </TableRow>
  526.                   <TableRow>
  527.                     <TableRowColumn><strong>Treasury Yield:</strong></TableRowColumn>
  528.                     <TableRowColumn> {request.treasury_yield}</TableRowColumn>
  529.                   </TableRow>
  530.                   <TableRow>
  531.                     <TableRowColumn><strong>Fair Yield:</strong></TableRowColumn>
  532.                     <TableRowColumn>{request.fair_yield}</TableRowColumn>
  533.                   </TableRow>
  534.                   <TableRow>
  535.                     <TableRowColumn><strong>Final Yield:</strong></TableRowColumn>
  536.                     <TableRowColumn>{request.final_yield}</TableRowColumn>
  537.                   </TableRow>
  538.                 </TableBody>
  539.               </Table>
  540.               </div>
  541.               }
  542.             </CardText>
  543.           </Card>
  544.         </div>
  545.         : <h1>Not Found</h1>}
  546.       </div>
  547.     );
  548.   }
  549. }
  550.  
  551.  
  552. let fancyTitle = (
  553.   <span>
  554.     <img src={logo} style={{width: '80%'}} alt="Scient Capital"/>
  555.   </span>
  556. );
  557.  
  558.  
  559. const PrivateRoute = ({ component: Component, ...rest }) => (
  560.   <Route {...rest} render={props => (
  561.     loggedIn() ? (
  562.       <Component {...props}/>
  563.     ) : (
  564.       <Redirect to={{
  565.         pathname: '/login',
  566.         state: { from: props.location }
  567.       }}/>
  568.     )
  569.   )}/>
  570. )
  571.  
  572. class AppNavbar extends Component {
  573.   state = {
  574.     logged: loggedIn,
  575.     open: false,
  576.     user: false
  577.   };
  578.  
  579.   handleClose = () => this.setState({open: false});
  580.  
  581.   handleToggle = (e) => {
  582.     this.setState({open: !this.state.open})
  583.   }
  584.  
  585.   logout() {
  586.     logout()
  587.     this.setState({redirect: true, user: false})
  588.   }
  589.  
  590.   componentDidMount() {
  591.     if (localStorage.token) {
  592.       axios
  593.         .get(rootURL + '/auth/user_info', {
  594.           headers: {
  595.             'Authorization': 'Token ' + localStorage.token
  596.           }
  597.         })
  598.         .then(res => {
  599.           const user = res.data
  600.           this.setState({ user })
  601.         })
  602.       } else {
  603.         this.setState({user: false})
  604.       }
  605.   }
  606.  
  607.   render() {
  608.     return (
  609.       <div>
  610.         <AppBar
  611.           title='Home'
  612.           onLeftIconButtonTouchTap={this.handleToggle}
  613.           style={{backgroundColor: '#014e5e'}}
  614.           iconElementRight={<FlatButton label={localStorage.token && this.state.user ? this.state.user.username : ''} icon={<Person />}/>}
  615.         />
  616.         <Drawer
  617.           open={this.state.open}
  618.           docked={false}
  619.           width={200}
  620.           style={{backgroundColor: '#014e5e'}}
  621.           onRequestChange={(open) => this.setState({open})}>
  622.           <AppBar
  623.             title={fancyTitle}
  624.             showMenuIconButton={false}
  625.             onTitleTouchTap={this.handleToggle}
  626.             style={{backgroundColor: '#014e5e'}}
  627.           />
  628.           <MenuItem
  629.             primaryText="Score Request"
  630.             containerElement={<Link to="/score-request/" />}
  631.             onClick={this.handleClose}
  632.           />
  633.           <MenuItem
  634.             primaryText="Logout"
  635.             href='/account/logout/'
  636.             containerElement={<Link to="/logout" />}
  637.             onClick={this.handleClose}
  638.           />
  639.           <Divider />
  640.           <p style={{position:'absolute', bottom:'0px', fontSize: 13, marginLeft: 10, color: 'grey', marginRight: 7}}>
  641.             © 2017 Scient Capital Private Limited. <br />
  642.             All Rights Reserved.
  643.           </p>
  644.         </Drawer>
  645.       </div>
  646.     );
  647.   }
  648. }
  649.  
  650. class Navbar extends Component {
  651.  
  652.   render() {
  653.     return (
  654.       <Router>
  655.         <div>
  656.           <AppNavbar />
  657.           <div style={{marginLeft:'20%'}}>
  658.             <Switch>
  659.               <PrivateRoute path="/score-request/:id" component={Request}/>
  660.               <PrivateRoute path="/score-request/" component={ScoreRequest}/>
  661.               <Route path="/login" component={Login}/>
  662.               <Route path="/logout" component={(Logout)}/>
  663.               <Route exact path="/" component={Home}/>
  664.             </Switch>
  665.           </div>
  666.         </div>
  667.       </Router>
  668.     );
  669.   }
  670.  
  671. }
  672.  
  673. export default Navbar;
Add Comment
Please, Sign In to add comment