From 0c7475cc35722a7529c4f9e1ac90f241b019880a Mon Sep 17 00:00:00 2001 From: Alexandru Munteanu <alexandru.munt@gmail.com> Date: Thu, 12 Apr 2018 17:05:50 +0300 Subject: [PATCH] fix(author-list): add correct initial values for author adder --- .../src/components/AuthorList/AuthorAdder.js | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/components-faraday/src/components/AuthorList/AuthorAdder.js b/packages/components-faraday/src/components/AuthorList/AuthorAdder.js index ee937adff..1fc5ae03b 100644 --- a/packages/components-faraday/src/components/AuthorList/AuthorAdder.js +++ b/packages/components-faraday/src/components/AuthorList/AuthorAdder.js @@ -81,16 +81,23 @@ export default compose( authorFailure, }, ), - withProps(({ currentUser: { admin, username, email }, authors }) => { - if (!admin && authors.length === 0) { - return { - initialValues: { - email, - firstName: username, - }, + withProps( + ({ + currentUser: { admin, affiliation, firstName, lastName, email }, + authors, + }) => { + if (!admin && authors.length === 0) { + return { + initialValues: { + affiliation, + email, + firstName, + lastName, + }, + } } - } - }), + }, + ), reduxForm({ form: 'author', enableReinitialize: true, -- GitLab