diff --git a/packages/components-faraday/src/components/AuthorList/AuthorAdder.js b/packages/components-faraday/src/components/AuthorList/AuthorAdder.js index 2cb1d3258fbd47afa1004fa0fb6af36b29a46314..aef24acfa0d5657ceebb00eaf8bbc2f03b915895 100644 --- a/packages/components-faraday/src/components/AuthorList/AuthorAdder.js +++ b/packages/components-faraday/src/components/AuthorList/AuthorAdder.js @@ -110,9 +110,11 @@ export default compose( fragmentId, ).then(author => { const newAuthors = [...authors, author] - setFormAuthors(newAuthors) - reset() setEditMode(false)() + setTimeout(() => { + setFormAuthors(newAuthors) + }, 1000) + reset() }) }, }), diff --git a/packages/components-faraday/src/redux/authors.js b/packages/components-faraday/src/redux/authors.js index c9a863d768a3efe1a824667ef4e8f52528c0a859..a4219d6ae9872ef33d02364f2371bc01531bc1bd 100644 --- a/packages/components-faraday/src/redux/authors.js +++ b/packages/components-faraday/src/redux/authors.js @@ -1,5 +1,4 @@ import { get } from 'lodash' -import * as api from 'pubsweet-client/src/helpers/api' // constants const REQUEST = 'authors/REQUEST' @@ -20,19 +19,8 @@ export const authorSuccess = () => ({ type: SUCCESS, }) -export const addAuthor = (author, collectionId, fragmentId) => dispatch => { - dispatch(authorRequest()) - return api - .create( - `/collections/${collectionId}/fragments/${fragmentId}/authors`, - author, - ) - .then(author => { - dispatch(authorSuccess()) - return author - }) - .catch(err => dispatch(authorFaiure(err))) -} +export const addAuthor = (author, collectionId, fragmentId) => dispatch => + Promise.resolve(author) // selectors export const getFragmentAuthors = (state, fragmentId) =>