chore: Migrate all instances of old vuelidate to new v2 syntax

This commit is contained in:
Fayaz Ahmed
2024-06-10 15:15:14 +05:30
parent 20b2dc8c6f
commit e0ddeb4ee6
47 changed files with 588 additions and 405 deletions
@@ -10,12 +10,12 @@
class="form-input"
:placeholder="$t('EMAIL_PLACEHOLDER')"
:class="inputHasError"
@input="$v.email.$touch"
@input="v$.email.$touch"
@keydown.enter="onSubmit"
/>
<button
class="button small"
:disabled="$v.email.$invalid"
:disabled="v$.email.$invalid"
:style="{
background: widgetColor,
borderColor: widgetColor,
@@ -31,6 +31,7 @@
<script>
import { mapGetters } from 'vuex';
import { useVuelidate } from '@vuelidate/core';
import { required, email } from 'vuelidate/lib/validators';
import { getContrastingTextColor } from '@chatwoot/utils';
@@ -54,6 +55,9 @@ export default {
default: () => {},
},
},
setup() {
return { v$: useVuelidate() };
},
data() {
return {
email: '',
@@ -79,7 +83,7 @@ export default {
${this.$dm('border-black-200', 'dark:border-black-500')}`;
},
inputHasError() {
return this.$v.email.$error
return this.v$.email.$error
? `${this.inputColor} error`
: `${this.inputColor}`;
},
@@ -92,7 +96,7 @@ export default {
},
methods: {
async onSubmit() {
if (this.$v.$invalid) {
if (this.v$.$invalid) {
return;
}
this.isUpdating = true;