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

fix(author-list): fix 409 when adding authors

parent 51ba76eb
No related branches found
No related tags found
No related merge requests found
...@@ -110,9 +110,11 @@ export default compose( ...@@ -110,9 +110,11 @@ export default compose(
fragmentId, fragmentId,
).then(author => { ).then(author => {
const newAuthors = [...authors, author] const newAuthors = [...authors, author]
setFormAuthors(newAuthors)
reset()
setEditMode(false)() setEditMode(false)()
setTimeout(() => {
setFormAuthors(newAuthors)
}, 1000)
reset()
}) })
}, },
}), }),
......
import { get } from 'lodash' import { get } from 'lodash'
import * as api from 'pubsweet-client/src/helpers/api'
// constants // constants
const REQUEST = 'authors/REQUEST' const REQUEST = 'authors/REQUEST'
...@@ -20,19 +19,8 @@ export const authorSuccess = () => ({ ...@@ -20,19 +19,8 @@ export const authorSuccess = () => ({
type: SUCCESS, type: SUCCESS,
}) })
export const addAuthor = (author, collectionId, fragmentId) => dispatch => { export const addAuthor = (author, collectionId, fragmentId) => dispatch =>
dispatch(authorRequest()) Promise.resolve(author)
return api
.create(
`/collections/${collectionId}/fragments/${fragmentId}/authors`,
author,
)
.then(author => {
dispatch(authorSuccess())
return author
})
.catch(err => dispatch(authorFaiure(err)))
}
// selectors // selectors
export const getFragmentAuthors = (state, fragmentId) => export const getFragmentAuthors = (state, fragmentId) =>
......
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