Tanya Sashyna пре 5 година
родитељ
комит
7a2d4523e0
1 измењених фајлова са 6 додато и 4 уклоњено
  1. 6 4
      src/components/sidebar/Sidebar.js

+ 6 - 4
src/components/sidebar/Sidebar.js

@@ -44,7 +44,9 @@ export class Sidebar extends React.Component {
 
 
     render() {
     render() {
         
         
-	    const { showSidebar, showSidebarFlag } = this.props;
+        const { showSidebar, showSidebarFlag } = this.props;
+        const role = localStorage.user && JSON.parse(localStorage.user).user.role;
+
         return (
         return (
             <div className={ !showSidebarFlag ? 'menu close' : 'menu' }>
             <div className={ !showSidebarFlag ? 'menu close' : 'menu' }>
                 <nav>
                 <nav>
@@ -55,7 +57,7 @@ export class Sidebar extends React.Component {
                     </div>
                     </div>
                     <ul>
                     <ul>
 						{
 						{
-                            localStorage.user && <li><Link to="/profile">Profile</Link></li>
+                            role && <li><Link to="/profile">Profile</Link></li>
 						}
 						}
 						
 						
                         {
                         {
@@ -66,10 +68,10 @@ export class Sidebar extends React.Component {
                             )
                             )
                         }
                         }
 						{
 						{
-                            !localStorage.user && <li><Link to="/login">Login</Link></li>
+                            !role && <li><Link to="/login">Login</Link></li>
 						}
 						}
                         {
                         {
-                            localStorage.user && <li>
+                            role && <li>
                                 <button className="logout" onClick={this.logoutHandler}>
                                 <button className="logout" onClick={this.logoutHandler}>
                                     <i className="fa fa-sign-out"></i>
                                     <i className="fa fa-sign-out"></i>
                                 </button>
                                 </button>