import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';

// =========== Components ===========
import App from '../components/app';
import NotFound from '../components/public-pages/not-found';
// Products
import Products from '../components/products/';
// Layout
import Header from '../components/navigation/header';
import Footer from '../components/navigation/footer';
// authentication
import Register from '../components/auth/register';
import SignIn from '../components/auth/sign-in';
import Profile from '../components/auth/profile';
// Hide order component
import RequireAuth from '../components/auth/hoc/require-auth';
import HideAuth from '../components/auth/hoc/hide-auth';


export default (
  <Router>
    <div>
      <Header />
      <Switch>
        <Route exact path="/" component={App} />
        <Route path="/register" component={HideAuth(Register)} />
        <Route path="/sign_in" component={HideAuth(SignIn)} />
        <Route path="/profile" component={RequireAuth(Profile)} />
        <Route path="/products" component={HideAuth(Products)} />
        <Route component={NotFound} />
      </Switch>
      <footer />
    </div>
  </Router>
)
import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';

// =========== Components ===========
import App from '../components/app';
import NotFound from '../components/public-pages/not-found';
// Layout
import Header from '../components/navigation/header';
import Footer from '../components/navigation/footer';
// authentication
import Register from '../components/auth/register';
import SignIn from '../components/auth/sign-in';
import Profile from '../components/auth/profile';


export default (
  <Router>
    <div>
      <Header />
      <Switch>
        <Route exact path="/" component={App} />
        <Route path="/register" component={Register} />
        <Route path="/sign_in" component={SignIn} />
        <Route path="/profile" component={Profile} />
        <Route component={NotFound} />
      </Switch>
      <footer />
    </div>
  </Router>
)
--- 
+++ 
@@ -4,6 +4,8 @@
 // =========== Components ===========
 import App from '../components/app';
 import NotFound from '../components/public-pages/not-found';
+// Products
+import Products from '../components/products/';
 // Layout
 import Header from '../components/navigation/header';
 import Footer from '../components/navigation/footer';
@@ -11,6 +13,9 @@
 import Register from '../components/auth/register';
 import SignIn from '../components/auth/sign-in';
 import Profile from '../components/auth/profile';
+// Hide order component
+import RequireAuth from '../components/auth/hoc/require-auth';
+import HideAuth from '../components/auth/hoc/hide-auth';
 
 
 export default (
@@ -19,9 +24,10 @@
       <Header />
       <Switch>
         <Route exact path="/" component={App} />
-        <Route path="/register" component={Register} />
-        <Route path="/sign_in" component={SignIn} />
-        <Route path="/profile" component={Profile} />
+        <Route path="/register" component={HideAuth(Register)} />
+        <Route path="/sign_in" component={HideAuth(SignIn)} />
+        <Route path="/profile" component={RequireAuth(Profile)} />
+        <Route path="/products" component={HideAuth(Products)} />
         <Route component={NotFound} />
       </Switch>
       <footer />
Hide components if user is logged
