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

Remove authors from redux

parent 3ff3c6fa
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@ import React from 'react'
import { get } from 'lodash'
import classnames from 'classnames'
import { ValidatedField, Button } from '@pubsweet/ui'
import { AuthorList } from 'pubsweet-components-faraday/src/components'
import classes from './WizardStep.local.scss'
import AutosaveIndicator from './AutosaveIndicator'
......@@ -67,7 +66,6 @@ export default ({
},
)}
<AuthorList />
<div className={classnames(classes.buttons)}>
<Button onClick={isFirst ? () => history.push('/') : prevStep}>
{isFirst
......
......@@ -83,7 +83,7 @@ export default compose(
onSubmit: (
values,
dispatch,
{ authors, addAuthor, setEditMode, reset, match },
{ authors, addAuthor, setEditMode, setFormAuthors, reset, match },
) => {
const collectionId = get(match, 'params.project')
const fragmentId = get(match, 'params.version')
......@@ -96,7 +96,9 @@ export default compose(
},
collectionId,
fragmentId,
).then(() => {
).then(author => {
const newAuthors = [...authors, author]
setFormAuthors(newAuthors)
reset()
setEditMode(false)()
})
......
......@@ -38,6 +38,7 @@ const Authors = ({
editMode,
setEditMode,
editedAuthor,
setFormAuthors,
...rest
}) => (
<div>
......@@ -48,12 +49,14 @@ const Authors = ({
editMode={editMode}
match={match}
setEditMode={setEditMode}
setFormAuthors={setFormAuthors}
/>
{editedAuthor > -1 ? (
<StaticList
authors={authors}
editComponent={AuthorEditor}
editIndex={editedAuthor}
setFormAuthors={setFormAuthors}
{...rest}
/>
) : (
......
......@@ -104,7 +104,7 @@ const SortableList = ({
<DecoratedItem
dragHandle={dragHandle}
index={i}
key={item.name || Math.random()}
key={item.id}
listItem={listItem}
moveItem={moveItem}
{...item}
......
import { get } from 'lodash'
import * as api from 'pubsweet-client/src/helpers/api'
// constants
......@@ -6,16 +5,10 @@ export const SET_AUTHORS = 'authors/SET_AUTHORS'
// actions
export const addAuthor = (author, collectionId, fragmentId) => dispatch =>
api
.create(
`/collections/${collectionId}/fragments/${fragmentId}/authors`,
author,
)
.then(r => console.log('esposa', r))
// .then(() =>
// dispatch(actions.getFragment({ id: collectionId }, { id: fragmentId })),
// )
// .then(({ fragment: { authors, id } }) => dispatch(setAuthors(authors, id)))
api.create(
`/collections/${collectionId}/fragments/${fragmentId}/authors`,
author,
)
// selectors
......
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