Progress on DMs responsiveness

Progress on DMs responsiveness
This commit is contained in:
mgabdev
2020-12-03 22:27:09 -05:00
parent 137a36b810
commit f6a7422704
29 changed files with 682 additions and 186 deletions

View File

@@ -72,15 +72,17 @@ export const expandChatMessages = (chatConversationId, params = {}, done = noop)
dispatch(expandChatMessagesRequest(chatConversationId, isLoadingMore))
api(getState).get(`/api/v1/chat_conversations/messages/${chatConversationId}`, { params }).then((response) => {
console.log("response:", response)
api(getState).get(`/api/v1/chat_conversations/messages/${chatConversationId}`, {
params: {
max_id: params.maxId,
since_id: params.sinceId,
}
}).then((response) => {
const next = getLinks(response).refs.find(link => link.rel === 'next')
console.log("next:", next, getLinks(response).refs)
dispatch(importFetchedChatMessages(response.data))
dispatch(expandChatMessagesSuccess(chatConversationId, response.data, next ? next.uri : null, response.code === 206, isLoadingRecent, isLoadingMore))
done()
}).catch((error) => {
console.log("error:", error)
dispatch(expandChatMessagesFail(chatConversationId, error, isLoadingMore))
done()
})