Commit 60186f2b authored by Jure's avatar Jure

Fix authentication issues

parent 81b4bab6
import React from 'react'
import PropTypes from 'prop-types'
import AuthenticatedComponent from 'pubsweet-client/src/components/AuthenticatedComponent'
import Navigation from './Navigation/Navigation'
const App = ({ children, ...props }) => (
<div>
<Navigation />
<AuthenticatedComponent
operation="GET"
selector={state => state.collections[0]}
unauthorized={<p>You are not authorized to view this page.</p>}
{...props}
>
{children}
</AuthenticatedComponent>
{children}
</div>
)
......
......@@ -13,16 +13,29 @@ import HTML from 'pubsweet-component-html/HTMLContainer'
import Login from 'pubsweet-component-login/LoginContainer'
import Signup from 'pubsweet-component-signup/SignupContainer'
import PasswordReset from 'pubsweet-component-password-reset-frontend/PasswordReset'
import AuthenticatedComponent from 'pubsweet-client/src/components/AuthenticatedComponent'
import App from './components/App'
// eslint-disable-next-line
const PrivateRoute = ({ component: Component, ...rest }) => (
<Route
{...rest}
render={props => (
<AuthenticatedComponent>
<Component {...props} />
</AuthenticatedComponent>
)}
/>
)
export default (
<App>
<Switch>
<Route component={Blog} exact path="/" />
<Route component={UsersManager} path="/manage/users" />
<Route component={PostsManager} path="/manage/posts" />
<PrivateRoute component={UsersManager} path="/manage/users" />
<PrivateRoute component={PostsManager} path="/manage/posts" />
<Route component={Blog} exact path="/" />
<Route component={Login} path="/login" />
<Route component={Signup} path="/signup" />
<Route component={PasswordReset} path="/password-reset" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment