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'
import { get } from 'lodash'
import { compose } from 'recompose'
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'
const AdminRoute = ({
......@@ -13,9 +13,14 @@ const AdminRoute = ({
}) => {
const isAdmin = get(currentUser, 'user.admin')
return (
<AuthenticatedComponent>
{isAdmin ? <Component {...rest} /> : <Redirect to="/" />}
</AuthenticatedComponent>
<Route
{...rest}
render={props => (
<AuthenticatedComponent>
{isAdmin ? <Component {...props} /> : <Redirect to="/" />}
</AuthenticatedComponent>
)}
/>
)
}
......
......@@ -32,7 +32,7 @@ const AppBar = ({
<Dropdown>
<DropdownOption>Settings</DropdownOption>
{currentUser.admin && (
<DropdownOption onClick={goTo('admin')}>
<DropdownOption onClick={goTo('/admin')}>
Admin dashboard
</DropdownOption>
)}
......
import React from 'react'
// import { withProps } from 'recompose'
import { Route, Switch } from 'react-router-dom'
import { AuthenticatedComponent } from 'pubsweet-client'
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