diff --git a/components/modal.vue b/components/modal.vue index fab00a0..b0c8c20 100644 --- a/components/modal.vue +++ b/components/modal.vue @@ -30,12 +30,15 @@ type modalDataType = { phone?: string name?: string email?: string + policy: boolean } const modal_data = reactive({ email: undefined, phone: undefined, - name: undefined + name: undefined, + policy: true }) + const modal_form = reactive({ disabled: true, errors: [], @@ -62,13 +65,17 @@ const validate = () => { modal_form.disabled = true if ( - (modal_data.phone && phone_regexp.test(modal_data.phone)) - || (modal_data.email && email_regex.test(modal_data.email)) + ( + (modal_data.phone && phone_regexp.test(modal_data.phone)) + || (modal_data.email && email_regex.test(modal_data.email)) + ) && modal_data.policy == true ) { modal_form.disabled = false return } } +watch(modal_data, validate) + const submit = async (e: any) => { goal('submit_form', modal_data) modal_state.show_status = 'loading' @@ -202,15 +209,15 @@ const policy = () => {