diff --git a/src/api/appType/whatsapp/index.js b/src/api/appType/whatsapp/index.js index 14def5b1..909b278a 100644 --- a/src/api/appType/whatsapp/index.js +++ b/src/api/appType/whatsapp/index.js @@ -42,11 +42,10 @@ export default { deleteTemplateMessage(appUuid, templateUuid) { return request.$http.delete(`${templatesResource}/${appUuid}/templates/${templateUuid}`); }, - createTemplateTranslation(appUuid, templateUuid, data) { - return request.$http.post( - `${templatesResource}/${appUuid}/templates/${templateUuid}/translations/`, - data, - ); + async createTemplateTranslation(appUuid, templateUuid, data) { + return await request.$http + .post(`${templatesResource}/${appUuid}/templates/${templateUuid}/translations/`, data) + .then((r) => r.data); }, updateTemplateTranslation(appUuid, templateUuid, data) { return request.$http.patch(`${templatesResource}/${appUuid}/templates/${templateUuid}/`, data); diff --git a/src/components/whatsAppTemplates/FormTabs.vue b/src/components/whatsAppTemplates/FormTabs.vue index 8a7794c5..62ca9927 100644 --- a/src/components/whatsAppTemplates/FormTabs.vue +++ b/src/components/whatsAppTemplates/FormTabs.vue @@ -360,11 +360,10 @@ await this.createTemplate({ appUuid, payload: templatePayload }); if (this.errorCreateTemplate) { this.callErrorModal({ text: this.$t('WhatsApp.templates.error.create_template') }); - this.loadingSave = false; return; } - currentTemplateUuid = this.createdTemplateData.uuid; + this.loadingSave = false; } const translationPayload = this.buildPayload(); @@ -384,7 +383,6 @@ translationPayload, }); } - this.loadingSave = false; }, async createTranslation({ currentTemplateUuid, translationPayload }) { @@ -396,7 +394,10 @@ }); if (this.errorCreateTemplateTranslation) { - this.callErrorModal({ text: this.$t('WhatsApp.templates.error.create_translation') }); + const errorText = + this.errorCreateTemplateTranslation?.error_user_msg || + this.$t('WhatsApp.templates.error.create_translation'); + this.callErrorModal({ text: errorText }); } else { this.callSuccessModal({ text: this.$t('WhatsApp.templates.success.create_translation') }); } @@ -717,9 +718,11 @@ ::-webkit-scrollbar { height: $unnnic-border-width-thick; } + ::-webkit-scrollbar-track { background: $unnnic-color-neutral-soft; } + ::-webkit-scrollbar-thumb { background: $unnnic-color-neutral-clean; border-radius: $unnnic-border-radius-md; diff --git a/src/store/appType/channels/whatsapp/actions.js b/src/store/appType/channels/whatsapp/actions.js index 4f5ea8e8..39d179ce 100644 --- a/src/store/appType/channels/whatsapp/actions.js +++ b/src/store/appType/channels/whatsapp/actions.js @@ -49,10 +49,9 @@ export default { async updateWppProfile({ commit }, { code, appUuid, payload }) { commit('UPDATE_WHATSAPP_PROFILE_REQUEST'); try { - const { data } = await whatsApp.updateWppProfile(code, appUuid, payload); + const data = await whatsApp.updateWppProfile(code, appUuid, payload); commit('UPDATE_WHATSAPP_PROFILE_SUCCESS', data); } catch (err) { - captureSentryException(err); commit('UPDATE_WHATSAPP_PROFILE_ERROR', err); } }, @@ -141,11 +140,12 @@ export default { async createTemplateTranslation({ commit }, { appUuid, templateUuid, payload }) { commit('CREATE_TEMPLATE_TRANSLATION_REQUEST'); try { - const { data } = await whatsApp.createTemplateTranslation(appUuid, templateUuid, payload); + const data = await whatsApp.createTemplateTranslation(appUuid, templateUuid, payload); commit('CREATE_TEMPLATE_TRANSLATION_SUCCESS', data); } catch (err) { captureSentryException(err); - commit('CREATE_TEMPLATE_TRANSLATION_ERROR', err); + const error = err.response?.data?.error; + commit('CREATE_TEMPLATE_TRANSLATION_ERROR', error || err); } },