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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user