Skip to content
Snippets Groups Projects
Commit 302f5fe3 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

Merge branch 'faraday-master' of gitlab.coko.foundation:xpub/xpub into faraday-master

parents c873bd41 6afb479d
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ import React from 'react' ...@@ -2,7 +2,7 @@ import React from 'react'
import { get } from 'lodash' import { get } from 'lodash'
import { compose } from 'recompose' import { compose } from 'recompose'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { Redirect, withRouter } from 'react-router-dom' import { Redirect, withRouter, Route } from 'react-router-dom'
import { AuthenticatedComponent } from 'pubsweet-client' import { AuthenticatedComponent } from 'pubsweet-client'
const AdminRoute = ({ const AdminRoute = ({
...@@ -13,9 +13,14 @@ const AdminRoute = ({ ...@@ -13,9 +13,14 @@ const AdminRoute = ({
}) => { }) => {
const isAdmin = get(currentUser, 'user.admin') const isAdmin = get(currentUser, 'user.admin')
return ( return (
<AuthenticatedComponent> <Route
{isAdmin ? <Component {...rest} /> : <Redirect to="/" />} {...rest}
</AuthenticatedComponent> render={props => (
<AuthenticatedComponent>
{isAdmin ? <Component {...props} /> : <Redirect to="/" />}
</AuthenticatedComponent>
)}
/>
) )
} }
......
...@@ -32,7 +32,7 @@ const AppBar = ({ ...@@ -32,7 +32,7 @@ const AppBar = ({
<Dropdown> <Dropdown>
<DropdownOption>Settings</DropdownOption> <DropdownOption>Settings</DropdownOption>
{currentUser.admin && ( {currentUser.admin && (
<DropdownOption onClick={goTo('admin')}> <DropdownOption onClick={goTo('/admin')}>
Admin dashboard Admin dashboard
</DropdownOption> </DropdownOption>
)} )}
......
import React from 'react' import React from 'react'
// import { withProps } from 'recompose'
import { Route, Switch } from 'react-router-dom' import { Route, Switch } from 'react-router-dom'
import { AuthenticatedComponent } from 'pubsweet-client' import { AuthenticatedComponent } from 'pubsweet-client'
import Login from 'pubsweet-component-login/LoginContainer' import Login from 'pubsweet-component-login/LoginContainer'
......
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