diff --git a/app/javascript/components/email_addresses_editor.vue b/app/javascript/components/email_addresses_editor.vue index b18f7ba89..ea1cac3cf 100644 --- a/app/javascript/components/email_addresses_editor.vue +++ b/app/javascript/components/email_addresses_editor.vue @@ -13,7 +13,7 @@ @@ -33,6 +33,10 @@ + +

You are about to change the primary email address associated with this profile. This will change the login email used for this account.

+

Are you sure you wish to make this change?

+
@@ -42,11 +46,13 @@ import EmailAddressEditor from './email_address_editor.vue' import emailAddressMixin from '../store/email_address.mixin' import {personSessionMixin} from '@/mixins'; import modelUtilsMixin from "@/store/model_utils.mixin"; +import PlanoModal from './plano_modal.vue'; export default { name: 'EmailAddressesEditor', components: { - EmailAddressEditor + EmailAddressEditor, + PlanoModal }, mixins: [ modelUtilsMixin, @@ -68,12 +74,11 @@ export default { default: 'email-addresses-editor' } }, - data() { - return { - emails: [], - additional: [] - } - }, + data: () => ({ + emails: [], + additional: [], + pendingPrimaryChange: null + }), computed: { primary: { get: function() { @@ -102,7 +107,27 @@ export default { ) } }, - onInput(arg) { + onConfirmCancel() { + this.setLists() + this.pendingPrimaryChange = null; + }, + onConfirmOk() { + this.saveEmail(this.pendingPrimaryChange).then( + () => { + this.setLists() + } + ).catch((err) => { + console.log("i caught an error", err) + this.setLists() + }); + this.pendingPrimaryChange = null; + }, + onInput(arg, isPrimary = false) { + if(isPrimary) { + this.$bvModal.show('primaryEmailConfirm') + this.pendingPrimaryChange = arg; + return; + } if (arg.id) { this.saveEmail(arg).then( () => {