Skip to content

Commit

Permalink
fix(MessagesList): fix context request for empty chat
Browse files Browse the repository at this point in the history
Signed-off-by: DorraJaouad <dorra.jaoued7@gmail.com>
  • Loading branch information
DorraJaouad committed Apr 15, 2024
1 parent 0c0a82c commit 6132f8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/MessagesList/MessagesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,12 @@ export default {
if (Axios.isCancel(exception)) {
console.debug('The request has been canceled', exception)
}

if (exception?.response?.status === 304 && exception?.response?.data === '') {
// 304 - Not modified
// Empty chat, no messages to load
this.$store.dispatch('loadedMessagesOfConversation', { token: this.token })
}
}
this.loadingOldMessages = false
},
Expand Down
4 changes: 4 additions & 0 deletions src/store/messagesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,10 @@ const actions = {
async easeMessageList(context, { token }) {
context.commit('easeMessageList', { token })
},

loadedMessagesOfConversation(context, { token }) {
context.commit('loadedMessagesOfConversation', { token })
}
}

export default { state, mutations, getters, actions }

0 comments on commit 6132f8e

Please sign in to comment.