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