diff --git a/src/actions/auth.js b/src/actions/auth.js index 5950df0b84dcb31f76e8d85c6539c584420ff72e..ce05047688ca802476be3f6f908c5179c7a0591a 100644 --- a/src/actions/auth.js +++ b/src/actions/auth.js @@ -13,6 +13,7 @@ export const getUserData = () => ( motivation_about: motivationAbout, motivation_profession: motivationProfession, motivation_exercise: motivationExercise, + full_name, signed, groups, role, @@ -36,7 +37,7 @@ export const getUserData = () => ( dispatch({ type: GET_USERDATA, payload: { - id, joinDate, nick, motivationAbout, motivationProfession, motivationExercise, signed, groups, role, permission + id, joinDate, nick, motivationAbout, motivationProfession, motivationExercise, full_name, signed, groups, role, permission }, }); } catch (e) { diff --git a/src/actions/news.js b/src/actions/news.js index 0a953af5d51335bad8809c32f9eb2ad1c8d709e0..525370ce8b08087fb4bb4ff14d5f31e41ca76bfc 100644 --- a/src/actions/news.js +++ b/src/actions/news.js @@ -39,11 +39,11 @@ export const postNews = ({ title, author, text }) => ( } ); -export const editNews = ({ id, title, editedBy, text }) => ( +export const editNews = ({ id, title, text, updated_by}) => ( async (dispatch) => { try { const response = await axios.patch(`/api/v1/news/${id}/`, { - author: editedBy, + updated_by, title, text, }); diff --git a/src/components/forms/EditNewsForm.js b/src/components/forms/EditNewsForm.js index 7107e8d947e76d4fbbbc69cf448baf3f631b2e42..1dad4436aeffab75d6cf62f812d9f78737691718 100644 --- a/src/components/forms/EditNewsForm.js +++ b/src/components/forms/EditNewsForm.js @@ -14,7 +14,7 @@ class EditNewsForm extends Component { render() { const { id, title, text } = this.props.selectedNews; - const editedBy = this.props.user.id; + const updated_by = this.props.user.id; return ( <Modal open={this.state.showModal} @@ -63,7 +63,7 @@ class EditNewsForm extends Component { color='green' onClick={() => { this.props.editNews({ - id, title, text, editedBy, + id, title, text, updated_by, }); this.setState({ showModal: false }); this.props.clearWrite(); diff --git a/src/components/pages/News.js b/src/components/pages/News.js index 41260ea92dd30a22084df8dc50bcb0e638380b97..807a91442463d5198df3a9996012e6b5880d515f 100644 --- a/src/components/pages/News.js +++ b/src/components/pages/News.js @@ -29,7 +29,9 @@ class News extends Component { { this.props.user.role === 'Staff' ? <Grid.Column floated='right' width={4}> <EditNewsForm - onClick={() => this.props.setSelectedNews(item)} + onClick={() => { + this.props.setSelectedNews(item) + }} /> <Button compact @@ -54,9 +56,9 @@ class News extends Component { <p> Szerkesztve: {moment(item.updated_at).format('LLLL')}</p> </Grid.Column> <Grid.Column floated='right' width={5}> - <p> Ărta: <strong>{item.author_name}</strong></p> + <p> Ărta: <strong>{item.author}</strong></p> {/* TODO get the edited by name */} - <p> Szerkesztette: {item.author_name}</p> + <p> Szerkesztette: {item.last_update_by}</p> </Grid.Column> </Grid.Row> </Grid>