fix: Add meaningful alert error message if file upload fails (#3093)
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
parent
a8f6eebd66
commit
6f6bb91823
3 changed files with 7 additions and 2 deletions
|
@ -347,7 +347,10 @@ export default {
|
|||
await this.$store.dispatch('sendMessage', messagePayload);
|
||||
this.$emit('scrollToMessage');
|
||||
} catch (error) {
|
||||
// Error
|
||||
const errorMessage =
|
||||
error?.response?.data?.error ||
|
||||
this.$t('CONVERSATION.MESSAGE_ERROR');
|
||||
this.showAlert(errorMessage);
|
||||
}
|
||||
this.hideEmojiPicker();
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
"CHANGE_AGENT": "Conversation Assignee changed",
|
||||
"CHANGE_TEAM": "Conversation team changed",
|
||||
"FILE_SIZE_LIMIT": "File exceeds the {MAXIMUM_FILE_UPLOAD_SIZE} attachment limit",
|
||||
"MESSAGE_ERROR": "Unable to send this message, please try again later",
|
||||
"SENT_BY": "Sent by:",
|
||||
"ASSIGNMENT": {
|
||||
"SELECT_AGENT": "Select Agent",
|
||||
|
|
|
@ -155,6 +155,7 @@ const actions = {
|
|||
},
|
||||
|
||||
sendMessage: async ({ commit }, data) => {
|
||||
// eslint-disable-next-line no-useless-catch
|
||||
try {
|
||||
const pendingMessage = createPendingMessage(data);
|
||||
commit(types.default.ADD_MESSAGE, pendingMessage);
|
||||
|
@ -164,7 +165,7 @@ const actions = {
|
|||
status: MESSAGE_STATUS.SENT,
|
||||
});
|
||||
} catch (error) {
|
||||
// Handle error
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue