Skip to content
Snippets Groups Projects
Commit 0f30ec07 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

Fix upload issue on faraday

parent 30ff83df
No related branches found
No related tags found
No related merge requests found
...@@ -67,7 +67,7 @@ export default ({ ...@@ -67,7 +67,7 @@ export default ({
<Button primary type="submit"> <Button primary type="submit">
{isFinal {isFinal
? `${wizard.submitText || 'Submit Manuscript'}` ? `${wizard.submitText || 'Submit Manuscript'}`
: `${wizard.nextText || 'Cancel'}`} : `${wizard.nextText || 'Next'}`}
</Button> </Button>
</div> </div>
</form> </form>
......
...@@ -44,7 +44,6 @@ const AuthorBackend = app => { ...@@ -44,7 +44,6 @@ const AuthorBackend = app => {
fragment = await fragment.save() fragment = await fragment.save()
res.status(200).json(fragment) res.status(200).json(fragment)
} catch (e) { } catch (e) {
console.log(e)
if (e.name === 'NotFoundError') { if (e.name === 'NotFoundError') {
res.status(e.status).json({ error: 'Fragment not found' }) res.status(e.status).json({ error: 'Fragment not found' })
return return
......
...@@ -6,8 +6,6 @@ const express = require('express') ...@@ -6,8 +6,6 @@ const express = require('express')
const supertest = require('supertest') const supertest = require('supertest')
const component = require('..') const component = require('..')
const token =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InNlYmkiLCJpZCI6IjVlMTRiY2IyLWQ5ZTEtNDZjOS05ZDI0LTM3YTk4MDhmMjFmYiIsImlhdCI6MTUxNjExODAxMSwiZXhwIjoxNTE2MjA0NDExfQ.tqH0Nnpiec2c1FPL2K5fK4krHGN2SrYyMbqVSnYSpog'
const author = { const author = {
first_name: 'marcel', first_name: 'marcel',
middle_name: 'sss', middle_name: 'sss',
......
...@@ -11,7 +11,7 @@ import * as journal from './config/journal' ...@@ -11,7 +11,7 @@ import * as journal from './config/journal'
import Routes from './routes' import Routes from './routes'
const history = createHistory() const history = createHistory()
export const store = configureStore(history, {}) const store = configureStore(history, {})
const theme = {} const theme = {}
const render = () => { const render = () => {
......
export default [
{
label: 'Cognitive Psychology',
value: 'cognitive-psychology',
},
{
label: 'Social Psychology',
value: 'social-psychology',
},
{
label: 'Personality Psychology',
value: 'personality-psychology',
},
{
label: 'Developmental Psychology',
value: 'developmental-psychology',
},
{
label: 'Clinical Psychology',
value: 'clinical-psychology',
},
{
label: 'Organizational Behavior',
value: 'organizational-behavior',
},
{
label: 'Methodology and Research Practice',
value: 'methodology',
},
]
export default [
{
label: 'Original Research Report',
value: 'original-research',
},
{
label: 'Review',
value: 'review',
},
{
label: 'Opinion/Commentary',
value: 'opinion',
},
{
label: 'Registered Report',
value: 'registered-report',
},
]
...@@ -7,4 +7,6 @@ export { default as editors } from './editors' ...@@ -7,4 +7,6 @@ export { default as editors } from './editors'
export { default as roles } from './roles' export { default as roles } from './roles'
export { default as wizard } from './submit-wizard' export { default as wizard } from './submit-wizard'
export { default as issueTypes } from './issues-types' export { default as issueTypes } from './issues-types'
export { default as articleTypes } from './article-types-tbrm'
export { default as articleSections } from './article-sections-tbrm'
export { default as manuscriptTypes } from './manuscript-types' export { default as manuscriptTypes } from './manuscript-types'
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
TextField, TextField,
Supplementary, Supplementary,
} from '@pubsweet/ui' } from '@pubsweet/ui'
import uploadFile from 'xpub-upload' import uploadFileFn from 'xpub-upload'
import { required, minChars, minSize } from 'xpub-validators' import { required, minChars, minSize } from 'xpub-validators'
import { AuthorList } from 'pubsweet-component-wizard/src/components' import { AuthorList } from 'pubsweet-component-wizard/src/components'
...@@ -34,9 +34,12 @@ const journal = { ...@@ -34,9 +34,12 @@ const journal = {
value: 'hindawi-faraday', value: 'hindawi-faraday',
} }
const uploadFile = input => uploadFileFn(input)
export default { export default {
showProgress: true, showProgress: true,
formSectionKeys: ['metadata', 'declarations', 'conflicts', 'notes', 'files'], formSectionKeys: ['metadata', 'declarations', 'conflicts', 'notes', 'files'],
dispatchFunctions: [uploadFile],
steps: [ steps: [
{ {
label: 'Journal details', label: 'Journal details',
...@@ -107,6 +110,7 @@ export default { ...@@ -107,6 +110,7 @@ export default {
fieldId: 'conflicts.hasConflicts', fieldId: 'conflicts.hasConflicts',
renderComponent: yesNoWithLabel, renderComponent: yesNoWithLabel,
label: 'Is there a potential conflict of interest?', label: 'Is there a potential conflict of interest?',
validate: [required],
}, },
{ {
dependsOn: { dependsOn: {
...@@ -125,22 +129,19 @@ export default { ...@@ -125,22 +129,19 @@ export default {
title: 'Manuscript Files Upload', title: 'Manuscript Files Upload',
children: [ children: [
{ {
fieldId: 'mainManuscripts', fieldId: 'files.manuscripts',
label: 'Main Manuscript', label: 'Main Manuscript',
renderComponent: Supplementary, renderComponent: Supplementary,
uploadFile,
}, },
{ {
fieldId: 'supplementalFiles', fieldId: 'files.supplementary',
label: 'Supplemental Files', label: 'Supplemental Files',
renderComponent: Supplementary, renderComponent: Supplementary,
uploadFile,
}, },
{ {
fieldId: 'coverLetter', fieldId: 'files.coverLetter',
label: 'Cover Letter', label: 'Cover Letter',
renderComponent: Supplementary, renderComponent: Supplementary,
uploadFile,
}, },
], ],
}, },
......
...@@ -29,12 +29,15 @@ module.exports = { ...@@ -29,12 +29,15 @@ module.exports = {
message: Joi.string(), message: Joi.string(),
}), }),
files: Joi.object({ files: Joi.object({
manuscript: Joi.object({ manuscript: Joi.any(),
name: Joi.string().required(), manuscripts: Joi.array().items(
type: Joi.string(), Joi.object({
size: Joi.number(), name: Joi.string().required(),
url: Joi.string(), type: Joi.string(),
}), size: Joi.number(),
url: Joi.string(),
}),
),
supplementary: Joi.array().items( supplementary: Joi.array().items(
Joi.object({ Joi.object({
name: Joi.string().required(), name: Joi.string().required(),
...@@ -43,6 +46,14 @@ module.exports = { ...@@ -43,6 +46,14 @@ module.exports = {
url: Joi.string(), url: Joi.string(),
}), }),
), ),
coverLetter: Joi.array().items(
Joi.object({
name: Joi.string().required(),
type: Joi.string(),
size: Joi.number(),
url: Joi.string(),
}),
),
}), }),
notes: Joi.object({ notes: Joi.object({
fundingAcknowledgement: Joi.string(), fundingAcknowledgement: Joi.string(),
......
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