mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
Merge pull request #28 from coralproject/post-comment
Post order bugfix
This commit is contained in:
@@ -54,8 +54,8 @@ const {setLoggedInUser} = authActions
|
||||
postAction: (item, action, user) => {
|
||||
return dispatch(postAction(item, action, user))
|
||||
},
|
||||
appendItemArray: (item, property, value) => {
|
||||
return dispatch(appendItemArray(item, property, value))
|
||||
appendItemArray: (item, property, value, addToFront) => {
|
||||
return dispatch(appendItemArray(item, property, value, addToFront))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,13 +186,13 @@ export function postItem (item, type, id) {
|
||||
return fetch('/api/v1/' + type, options)
|
||||
.then(
|
||||
response => {
|
||||
return response.ok ? response.text()
|
||||
return response.ok ? response.json()
|
||||
: Promise.reject(response.status + ' ' + response.statusText)
|
||||
}
|
||||
)
|
||||
.then((id) => {
|
||||
dispatch(addItem({...item, id}))
|
||||
return id
|
||||
.then((json) => {
|
||||
dispatch(addItem({...item, id:json.id}))
|
||||
return json.id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class CommentBox extends Component {
|
||||
updateItem(parent_id, 'showReply', false)
|
||||
postItem(comment, 'comments')
|
||||
.then((comment_id) => {
|
||||
appendItemArray(parent_id || id, related, comment_id, parent_id ? true : false)
|
||||
appendItemArray(parent_id || id, related, comment_id, parent_id ? false : true)
|
||||
addNotification('success', 'Your comment has been posted.')
|
||||
}).catch((err) => console.error(err))
|
||||
this.setState({body: ''})
|
||||
|
||||
Reference in New Issue
Block a user