refactor: use v$ instead of in AddAgent.vue

This commit is contained in:
Shivam Mishra
2024-07-24 16:53:24 +05:30
parent cd078ca5ce
commit c8739caaa6
@@ -11,37 +11,37 @@
@submit.prevent="addAgent()"
>
<div class="w-full">
<label :class="{ error: $v.agentName.$error }">
<label :class="{ error: v$.agentName.$error }">
{{ $t('AGENT_MGMT.ADD.FORM.NAME.LABEL') }}
<input
v-model.trim="agentName"
type="text"
:placeholder="$t('AGENT_MGMT.ADD.FORM.NAME.PLACEHOLDER')"
@input="$v.agentName.$touch"
@input="v$.agentName.$touch"
/>
</label>
</div>
<div class="w-full">
<label :class="{ error: $v.agentType.$error }">
<label :class="{ error: v$.agentType.$error }">
{{ $t('AGENT_MGMT.ADD.FORM.AGENT_TYPE.LABEL') }}
<select v-model="agentType">
<option v-for="role in roles" :key="role.name" :value="role.name">
{{ role.label }}
</option>
</select>
<span v-if="$v.agentType.$error" class="message">
<span v-if="v$.agentType.$error" class="message">
{{ $t('AGENT_MGMT.ADD.FORM.AGENT_TYPE.ERROR') }}
</span>
</label>
</div>
<div class="w-full">
<label :class="{ error: $v.agentEmail.$error }">
<label :class="{ error: v$.agentEmail.$error }">
{{ $t('AGENT_MGMT.ADD.FORM.EMAIL.LABEL') }}
<input
v-model.trim="agentEmail"
type="text"
:placeholder="$t('AGENT_MGMT.ADD.FORM.EMAIL.PLACEHOLDER')"
@input="$v.agentEmail.$touch"
@input="v$.agentEmail.$touch"
/>
</label>
</div>
@@ -49,8 +49,8 @@
<div class="w-full">
<woot-submit-button
:disabled="
$v.agentEmail.$invalid ||
$v.agentName.$invalid ||
v$.agentEmail.$invalid ||
v$.agentName.$invalid ||
uiFlags.isCreating
"
:button-text="$t('AGENT_MGMT.ADD.FORM.SUBMIT')"