From c9a8c380b2b30023adb282f823c7a67987a04f3c Mon Sep 17 00:00:00 2001
From: Bogdan Cochior <bogdan.cochior@thinslices.com>
Date: Thu, 26 Apr 2018 17:09:25 +0300
Subject: [PATCH] fix(reviewers): second decline appropriate message

---
 .../src/components/SignUp/ReviewerDecline.js             | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/packages/components-faraday/src/components/SignUp/ReviewerDecline.js b/packages/components-faraday/src/components/SignUp/ReviewerDecline.js
index acebe87b7..455db357d 100644
--- a/packages/components-faraday/src/components/SignUp/ReviewerDecline.js
+++ b/packages/components-faraday/src/components/SignUp/ReviewerDecline.js
@@ -3,10 +3,12 @@ import { th } from '@pubsweet/ui'
 import { connect } from 'react-redux'
 import styled from 'styled-components'
 import { withJournal } from 'xpub-journal'
+import { replace } from 'react-router-redux'
 import { compose, lifecycle } from 'recompose'
 
 import { RootContainer, Title } from './FormItems'
 import { reviewerDecline } from '../../redux/reviewers'
+import { redirectToError } from '../utils'
 
 const ReviewerDecline = ({ journal: { metadata: { email } } }) => (
   <RootContainer>
@@ -26,7 +28,7 @@ const ReviewerDecline = ({ journal: { metadata: { email } } }) => (
 
 export default compose(
   withJournal,
-  connect(null, { reviewerDecline }),
+  connect(null, { reviewerDecline, replace }),
   lifecycle({
     componentDidMount() {
       const {
@@ -34,8 +36,11 @@ export default compose(
         invitationId,
         invitationToken,
         reviewerDecline,
+        replace,
       } = this.props
-      reviewerDecline(invitationId, collectionId, invitationToken)
+      reviewerDecline(invitationId, collectionId, invitationToken).catch(
+        redirectToError(replace),
+      )
     },
   }),
 )(ReviewerDecline)
-- 
GitLab