feat: Ability to remove inbox avatar (#2885)

* Delete inbox avatar

1) New API endpoint added for deleting inbox avatar.
2) Delete avatar button in the inbox settings page.

Co-authored-by: Sojan Jose <sojan@pepalo.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Aswin Dev P.S
2021-08-31 15:12:05 +05:30
committed by GitHub
co-authored by Sojan Jose Muhsin Keloth
parent fdcc322660
commit 1ff9939a80
11 changed files with 143 additions and 12 deletions
@@ -22,7 +22,9 @@
<woot-avatar-uploader
:label="$t('INBOX_MGMT.ADD.WEBSITE_CHANNEL.CHANNEL_AVATAR.LABEL')"
:src="avatarUrl"
deleteAvatar
@change="handleImageUpload"
@onAvatarDelete="handleAvatarDelete"
/>
<woot-input
v-model.trim="selectedInboxName"
@@ -544,6 +546,23 @@ export default {
this.avatarFile = file;
this.avatarUrl = url;
},
async handleAvatarDelete() {
try {
await this.$store.dispatch(
'inboxes/deleteInboxAvatar',
this.currentInboxId
);
this.avatarFile = null;
this.avatarUrl = '';
this.showAlert(this.$t('INBOX_MGMT.DELETE.API.AVATAR_SUCCESS_MESSAGE'));
} catch (error) {
this.showAlert(
error.message
? error.message
: this.$t('INBOX_MGMT.DELETE.API.AVATAR_ERROR_MESSAGE')
);
}
},
},
validations: {
selectedAgents: {