Skip to content
Snippets Groups Projects
Commit 30dc0d09 authored by Audrey Hamelers's avatar Audrey Hamelers
Browse files

#794

parent ec788545
No related branches found
No related tags found
1 merge request!393Dev
import React from 'react' import React from 'react'
import { withRouter } from 'react-router' import { withRouter } from 'react-router'
import { Query } from 'react-apollo' import { Query } from 'react-apollo'
import { createBrowserHistory } from 'history'
import styled from 'styled-components' import styled from 'styled-components'
import { th } from '@pubsweet/ui-toolkit' import { th } from '@pubsweet/ui-toolkit'
import { H1 } from '@pubsweet/ui' import { H1 } from '@pubsweet/ui'
...@@ -63,10 +62,7 @@ const ActivityPageContainer = ({ currentUser, history, match, ...props }) => ( ...@@ -63,10 +62,7 @@ const ActivityPageContainer = ({ currentUser, history, match, ...props }) => (
) )
} }
if (!data) { if (!data) {
const { pathname, search } = props.location history.go()
createBrowserHistory({ forceRefresh: true }).push(
`/login?next=${pathname}${search}`,
)
return null return null
} }
if (currentUser.admin) { if (currentUser.admin) {
......
...@@ -169,9 +169,7 @@ const Dashboard = ({ currentUser }) => ( ...@@ -169,9 +169,7 @@ const Dashboard = ({ currentUser }) => (
) )
} }
if (!data) { if (!data) {
createBrowserHistory({ forceRefresh: true }).push( createBrowserHistory({ forceRefresh: true }).go()
'/login?next=/admin-dashboard',
)
return null return null
} }
return ( return (
......
...@@ -5,7 +5,6 @@ import { H2 as HTwo, Link } from '@pubsweet/ui' ...@@ -5,7 +5,6 @@ import { H2 as HTwo, Link } from '@pubsweet/ui'
import { th } from '@pubsweet/ui-toolkit' import { th } from '@pubsweet/ui-toolkit'
import { pageSize, states } from 'config' import { pageSize, states } from 'config'
import URLSearchParams from 'url-search-params' import URLSearchParams from 'url-search-params'
import { createBrowserHistory } from 'history'
import { Loading, LoadingIcon, Notification, Toggle, Pagination } from '../ui' import { Loading, LoadingIcon, Notification, Toggle, Pagination } from '../ui'
import { import {
USER_MANUSCRIPTS, USER_MANUSCRIPTS,
...@@ -46,7 +45,7 @@ const MyManuscripts = ({ currentUser, errors, history }) => ( ...@@ -46,7 +45,7 @@ const MyManuscripts = ({ currentUser, errors, history }) => (
) )
} }
if (!data) { if (!data) {
createBrowserHistory({ forceRefresh: true }).push('') history.go()
return null return null
} }
// get the total number of manuscripts to decide whether the toggles are required // get the total number of manuscripts to decide whether the toggles are required
......
...@@ -5,7 +5,6 @@ import styled from 'styled-components' ...@@ -5,7 +5,6 @@ import styled from 'styled-components'
import URLSearchParams from 'url-search-params' import URLSearchParams from 'url-search-params'
import { th } from '@pubsweet/ui-toolkit' import { th } from '@pubsweet/ui-toolkit'
import { Action, H2 as HTwo } from '@pubsweet/ui' import { Action, H2 as HTwo } from '@pubsweet/ui'
import { createBrowserHistory } from 'history'
import { pageSize } from 'config' import { pageSize } from 'config'
import { Loading, LoadingIcon, Notification, Pagination, Toggle } from '../ui' import { Loading, LoadingIcon, Notification, Pagination, Toggle } from '../ui'
import { ADMIN_MANUSCRIPTS } from './operations' import { ADMIN_MANUSCRIPTS } from './operations'
...@@ -72,7 +71,7 @@ class MyQueue extends React.Component { ...@@ -72,7 +71,7 @@ class MyQueue extends React.Component {
) )
} }
if (!data) { if (!data) {
createBrowserHistory({ forceRefresh: true }).push('/login') history.go()
return null return null
} }
const mine = [] const mine = []
......
...@@ -3,7 +3,6 @@ import { Query } from 'react-apollo' ...@@ -3,7 +3,6 @@ import { Query } from 'react-apollo'
import styled from 'styled-components' import styled from 'styled-components'
import { Action, H3, Link } from '@pubsweet/ui' import { Action, H3, Link } from '@pubsweet/ui'
import { th } from '@pubsweet/ui-toolkit' import { th } from '@pubsweet/ui-toolkit'
import { createBrowserHistory } from 'history'
import { METRICS, COUNT_PREPRINTS, WEEK_METRICS, STATS } from './operations' import { METRICS, COUNT_PREPRINTS, WEEK_METRICS, STATS } from './operations'
import { Loading, LoadingIcon, Table, Toggle } from '../ui' import { Loading, LoadingIcon, Table, Toggle } from '../ui'
import ManagementBase from './ManagementBase' import ManagementBase from './ManagementBase'
...@@ -178,9 +177,7 @@ class Metrics extends React.Component { ...@@ -178,9 +177,7 @@ class Metrics extends React.Component {
) )
} }
if (!data) { if (!data) {
createBrowserHistory({ forceRefresh: true }).push( this.props.history.go()
'/login?next=/admin-metrics',
)
return null return null
} }
......
...@@ -26,10 +26,7 @@ const ReviewPage = ({ match, ...props }) => ( ...@@ -26,10 +26,7 @@ const ReviewPage = ({ match, ...props }) => (
) )
} }
if (!data) { if (!data) {
const { pathname, search } = props.location createBrowserHistory({ forceRefresh: true }).go()
createBrowserHistory({ forceRefresh: true }).push(
`/login?next=${pathname}${search}`,
)
return null return null
} }
if (!data.manuscript) { if (!data.manuscript) {
......
...@@ -544,10 +544,7 @@ const CreatePage = ({ match, ...props }) => ( ...@@ -544,10 +544,7 @@ const CreatePage = ({ match, ...props }) => (
) )
} }
if (!data) { if (!data) {
const { pathname, search } = props.location createBrowserHistory({ forceRefresh: true }).go()
createBrowserHistory({ forceRefresh: true }).push(
`/login?next=${pathname}${search}`,
)
return null return null
} }
if (!data.manuscript) { if (!data.manuscript) {
......
...@@ -60,10 +60,7 @@ const SubmitPage = ({ match, currentUser, ...props }) => ( ...@@ -60,10 +60,7 @@ const SubmitPage = ({ match, currentUser, ...props }) => (
) )
} }
if (!data) { if (!data) {
const { pathname, search } = props.location createBrowserHistory({ forceRefresh: true }).go()
createBrowserHistory({ forceRefresh: true }).push(
`/login?next=${pathname}${search}`,
)
return null return null
} }
if (!data.manuscript) { if (!data.manuscript) {
......
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