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

feat(submit-revision): redirect to the new fragment

parent 3475fe62
No related branches found
No related tags found
1 merge request!14Sprint #15
// #region imports
import React from 'react'
import { get } from 'lodash'
import PropTypes from 'prop-types'
......@@ -5,6 +6,7 @@ import { connect } from 'react-redux'
import { th } from '@pubsweet/ui-toolkit'
import { required } from 'xpub-validators'
import { DragDropContext } from 'react-dnd'
import { withRouter } from 'react-router-dom'
import styled, { css } from 'styled-components'
import HTML5Backend from 'react-dnd-html5-backend'
import { ValidatedField, Button } from '@pubsweet/ui'
......@@ -46,6 +48,7 @@ import {
} from './utils'
import { Expandable } from '../molecules/'
// #endregion
const TextAreaField = input => <Textarea {...input} height={70} rows={6} />
const SubmitRevision = ({
......@@ -145,6 +148,7 @@ export default compose(
version,
}),
),
withRouter,
withModal(props => ({
modalComponent: ConfirmationModal,
})),
......
......@@ -203,14 +203,30 @@ export const onRevisionChange = debounce(_onRevisionChange, 1000, {
export const onRevisionSubmit = (
values,
dispatch,
{ submitRevision, version, project, showModal, hideModal },
{
history,
version,
project,
showModal,
hideModal,
setModalError,
submitRevision,
},
) => {
// submitRevision(project.id, version.id)
showModal({
title: 'Ready to submit your revision?',
subtitle: `Once submitted, the submission can't be modified.`,
onConfirm: () => {
hideModal()
submitRevision(project.id, version.id)
.then(r => {
dispatch(actions.getFragments({ id: project.id }))
return r
})
.then(r => {
history.push(`/projects/${r.collectionId}/version/${r.id}/details`)
hideModal()
})
.catch(e => setModalError('Something went wrong.'))
},
onCancel: hideModal,
})
......
......@@ -107,7 +107,7 @@ export const createRevision = (
})
}
export const submitRevision = (collId, fragId) =>
export const submitRevision = (collId, fragId) => dispatch =>
update(`/collections/${collId}/fragments/${fragId}/submit`)
/* reducer */
......
......@@ -32,6 +32,7 @@ module.exports = {
hasConflicts: Joi.any().valid(['yes', 'no']),
message: Joi.string(),
}),
commentsToReviewers: Joi.string(),
files: Joi.object({
manuscript: Joi.any(),
manuscripts: Joi.array().items(
......
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