iachat/app/javascript/dashboard/routes/dashboard/conversation/contact/NewConversation.vue
Ximena Sandoval cab5a3e53b
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>
2022-01-13 11:15:40 -08:00

61 lines
1.2 KiB
Vue

<template>
<woot-modal :show.sync="show" :on-close="onCancel">
<div class="column content-box">
<woot-modal-header
:header-title="$t('NEW_CONVERSATION.TITLE')"
:header-content="$t('NEW_CONVERSATION.DESC')"
/>
<conversation-form
:contact="contact"
:on-submit="onSubmit"
@success="onSuccess"
@cancel="onCancel"
/>
</div>
</woot-modal>
</template>
<script>
import ConversationForm from './ConversationForm';
export default {
components: {
ConversationForm,
},
props: {
show: {
type: Boolean,
default: false,
},
contact: {
type: Object,
default: () => ({}),
},
},
watch: {
'contact.id'(id) {
this.$store.dispatch('contacts/fetchContactableInbox', id);
},
},
mounted() {
const { id } = this.contact;
this.$store.dispatch('contacts/fetchContactableInbox', id);
},
methods: {
onCancel() {
this.$emit('cancel');
},
onSuccess() {
this.$emit('cancel');
},
async onSubmit(contactItem) {
const data = await this.$store.dispatch(
'contactConversations/create',
contactItem
);
return data;
},
},
};
</script>