chore: Add a redirect link to the conversation in success toast message (#3711)

When creating a conversation from the contacts tab now we can go directly to the conversation by clicking the link in the success message

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Ximena Sandoval
2022-01-13 12:15:40 -07:00
committed by GitHub
parent 359caf754c
commit cab5a3e53b
9 changed files with 40 additions and 11 deletions

View File

@@ -174,7 +174,6 @@ export default {
onSuccess() {
this.$emit('success');
},
async handleSubmit() {
this.$v.$touch();
if (this.$v.$invalid) {
@@ -182,9 +181,17 @@ export default {
}
try {
const payload = this.getNewConversation;
await this.onSubmit(payload);
const data = await this.onSubmit(payload);
const action = {
type: 'link',
to: `/app/accounts/${data.account_id}/conversations/${data.id}`,
message: this.$t('NEW_CONVERSATION.FORM.GO_TO_CONVERSATION'),
};
this.onSuccess();
this.showAlert(this.$t('NEW_CONVERSATION.FORM.SUCCESS_MESSAGE'));
this.showAlert(
this.$t('NEW_CONVERSATION.FORM.SUCCESS_MESSAGE'),
action
);
} catch (error) {
if (error instanceof ExceptionWithMessage) {
this.showAlert(error.data);

View File

@@ -49,7 +49,11 @@ export default {
this.$emit('cancel');
},
async onSubmit(contactItem) {
await this.$store.dispatch('contactConversations/create', contactItem);
const data = await this.$store.dispatch(
'contactConversations/create',
contactItem
);
return data;
},
},
};