Skip to content
Snippets Groups Projects
Commit f98d9eba authored by Iosif Boanca's avatar Iosif Boanca
Browse files

name was split in firstName and lastName

parent d117a605
No related branches found
No related tags found
2 merge requests!110Sprint 21 Features,!91Hin 904 fixes after merge
...@@ -3,7 +3,7 @@ import { actions } from 'pubsweet-client' ...@@ -3,7 +3,7 @@ import { actions } from 'pubsweet-client'
import { ConnectPage } from 'xpub-connect' import { ConnectPage } from 'xpub-connect'
import { withJournal } from 'xpub-journal' import { withJournal } from 'xpub-journal'
import { withRouter } from 'react-router-dom' import { withRouter } from 'react-router-dom'
import { head, get, isUndefined } from 'lodash' import { head, get, last, isUndefined } from 'lodash'
import { getFormValues, change as changeForm } from 'redux-form' import { getFormValues, change as changeForm } from 'redux-form'
import { import {
selectFragment, selectFragment,
...@@ -84,7 +84,7 @@ export default compose( ...@@ -84,7 +84,7 @@ export default compose(
withJournal, withJournal,
withRouter, withRouter,
withFetching, withFetching,
withState('publonReviewers', 'setPub', []), withState('publonReviewers', 'setPublonsReviewers', []),
withState('editorInChief', 'setEiC', 'N/A'), withState('editorInChief', 'setEiC', 'N/A'),
ConnectPage(({ match }) => [ ConnectPage(({ match }) => [
actions.getCollection({ id: match.params.project }), actions.getCollection({ id: match.params.project }),
...@@ -222,8 +222,6 @@ export default compose( ...@@ -222,8 +222,6 @@ export default compose(
setEiC(`${firstName} ${lastName}`) setEiC(`${firstName} ${lastName}`)
} }
}, },
setPublons: ({ setPub }) => (publonReviewers = []) =>
setPub(publonReviewers),
assignHE: ({ assignHE: ({
assignHandlingEditor, assignHandlingEditor,
fetchUpdatedCollection, fetchUpdatedCollection,
...@@ -423,7 +421,6 @@ export default compose( ...@@ -423,7 +421,6 @@ export default compose(
collection, collection,
fragment, fragment,
fetchUpdatedCollection, fetchUpdatedCollection,
setPublons,
setFetching: setListFetching, setFetching: setListFetching,
setError, setError,
clearError, clearError,
...@@ -433,19 +430,15 @@ export default compose( ...@@ -433,19 +430,15 @@ export default compose(
reviewerData: values, reviewerData: values,
fragmentId: fragment.id, fragmentId: fragment.id,
collectionId: collection.id, collectionId: collection.id,
isPublons: true, isPublon: true,
}) })
.then(() => { .then(() => {
setFetching(false) setFetching(false)
hideModal() hideModal()
fetchUpdatedCollection() fetchUpdatedCollection()
getPublonsReviewers({ getPublonsReviewers('plm') // fragment.id)
fragmentId: fragment.id, .then(r => console.log('dupa publons', r))
setPublons, .catch(handleError(setError))
setFetching: setListFetching,
setError,
clearError,
})
}) })
.catch(err => { .catch(err => {
setFetching(false) setFetching(false)
...@@ -485,11 +478,11 @@ export default compose( ...@@ -485,11 +478,11 @@ export default compose(
match, match,
history, history,
location, location,
setPublons,
shouldReview, shouldReview,
reviewerReports, reviewerReports,
setEditorInChief, setEditorInChief,
clearCustomError, clearCustomError,
setPublonsReviewers,
hasManuscriptFailure, hasManuscriptFailure,
fetchUpdatedCollection, fetchUpdatedCollection,
currentUser: { currentUser: {
...@@ -523,13 +516,26 @@ export default compose( ...@@ -523,13 +516,26 @@ export default compose(
) )
if (canInviteReviewers) { if (canInviteReviewers) {
getPublonsReviewers({ clearError()
fragmentId, setFetching(true)
setPublons, getPublonsReviewers(fragmentId)
setFetching, .then(res => {
setError, setFetching(false)
clearError, setPublonsReviewers(
}) res.map(r => {
const names = r.name.split(' ')
return {
...r,
firstName: names[0],
lastName: last(names),
}
}),
)
})
.catch(e => {
setFetching(false)
handleError(setError)(e)
})
} }
if (isInvitedHE) { if (isInvitedHE) {
......
...@@ -306,22 +306,5 @@ export const parseEicDecision = ({ decision, message }) => ({ ...@@ -306,22 +306,5 @@ export const parseEicDecision = ({ decision, message }) => ({
}) })
// handle publons // handle publons
export const getPublonsAPI = fragmentId => export const getPublonsReviewers = fragmentId =>
apiGet(`/fragments/${fragmentId}/publons`) apiGet(`/fragments/${fragmentId}/publons`)
export const getPublonsReviewers = ({
fragmentId,
setPublons,
setFetching,
setError,
clearError,
}) => {
clearError()
setFetching(true)
getPublonsAPI(fragmentId)
.then(res => {
setPublons(res)
setFetching(false)
})
.catch(handleError(setError))
}
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